Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to specify <RunCommand> tag in .Net Core .csproj file

Where to define this command in csproj file? bin\Debug\net47\MyApp.exe

I m using .net core 2.0.0 SDK. I m not getting RunCommand in Intellisense. Also while building my solution, I have 7 projects and main project is of type console application and its Output Type is EXE. Solution gets built successfully. While I press F5 it gives me MessageBox containing message like "Unable to run your project. The RunCommand is not defined."

How to solve this?

like image 762
milan.sangani Avatar asked Nov 07 '17 07:11

milan.sangani


1 Answers

This is typically set by the SDK. Most likely you are targeting netstandard2.0 (was it a Class Library project that you later added a Main() to?). Try targeting the specific runtime+version - in your case netcoreapp2.0 or net47 - instead.

If you want to build both Core and Full Framework you can specify multiple target frameworks by separating them with a semicolon and changing the TargetFramework tag name to plural (TargetFrameworks):

<TargetFrameworks>net47;netcoreapp2.0</TargetFrameworks>

Alternatively, you should be able to specify a <RunCommand> inside <PropertyGroup> in your .csproj file. FWIW I can't seem to get anything to show up in Intellisense except the generic <PropertyName> and anything I've already added to the list.

An example would be:

<RunCommand>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).exe</RunCommand>
like image 95
lc. Avatar answered Nov 11 '22 08:11

lc.