Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Help - The "RunCommand" property is not defined

I'm using Microsoft Visual Studio Community 2017. I have created a project with multiple classes to be compiled. The primary class I want the application to run first has public static void Main(string[] args) in it already. In the library, I've set properties to the following:

  • Target Framework: .NET standard 2.0
  • Output type: Console Application
  • Startup object: Main.Game

Still, the error persists with all the forums I have visited. If you have encountered this problem, please guide me through so I can compile my program. Thank you :)

like image 827
Cole Connelly Avatar asked Aug 24 '17 03:08

Cole Connelly


4 Answers

I was facing this issue in my Visual Studio 2017 15.7.2 version. The cause for this issue in my case was, unknowingly I had changed my Asp.Net Core 2.1 Web API project output type to Class Library. Changing it back to Windows Application fixed my issue. Just sharing the same for the users who does silly mistakes like me.

enter image description here

like image 139
Sibeesh Venu Avatar answered Sep 24 '22 02:09

Sibeesh Venu


Try changing from netstandard2.0 to netcoreapp2.0 for Target Framework.

like image 20
ForcedFakeLaugh Avatar answered Sep 26 '22 02:09

ForcedFakeLaugh


Unfortunately, Microsoft has this issue open (https://github.com/dotnet/sdk/issues/833) for a long time, but has provided no answer.

like image 43
Ricardo Peres Avatar answered Sep 27 '22 02:09

Ricardo Peres


From here

Try adding the following to you <PropertyGroup>:

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RunCommand>$(MSBuildExtensionsPath64)\..\IIS Express\iisexpress</RunCommand>
<RunArguments>/path:&quot;$(MSBuildProjectDirectory)&quot; /port:18082</RunArguments>
like image 27
Netanel Livni Avatar answered Sep 26 '22 02:09

Netanel Livni