Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Executable output when running 'dotnet run' after installing .NET core

Tags:

.net-core

I installed .NET Core following the instructions at the link below

http://dotnet.github.io/getting-started/

and I was able to get my 'hello world' working using 'dotnet run'. However, I couldn't see an exe file that all the documentation around the internet seems to indicate it would generate.

Running 'dotnet publish' pretty much copies those files into a different folder with 2 less files (removes the pdb file and the extra dev configs).

What am I missing?

Update 1

Here is the project.json file I have

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-rc2-23930"
    }
  },
  "frameworks": {
    "netstandard1.5": {}
  }
}
like image 840
Betsegaw Avatar asked Mar 16 '26 07:03

Betsegaw


1 Answers

You will only get a binary executable (exe file on Windows) when publishing a "self-contained" application (See Types of portability in .NET Core). Note: I'm using the current preview1 build version (1.0.0-rc2-3002702) for all Microsoft.NetCore.App references, but the same changes apply to other versions.

Basically, your project.json file should have the following changes:

1. Add a new section called runtimes:

"runtimes": {
  "win7-x64": {}
}

2. Remove the platform part of the Microsoft.NETCore.App dependency:

"Microsoft.NETCore.App": {
  "type": "platform",
  "version": "1.0.0-rc2-3002702"
}

Changes to:

"Microsoft.NETCore.App": "1.0.0-rc2-3002702"

3. Ensure that you are targetting netcoreapp1.0 and not netstandard1.*, netstandard1.* indicates that you are compiling a class library and not a standalone executable program. Your frameworks section should then look like:

"frameworks": {
  "netcoreapp1.0": {}
}

Once these changes are made, you can then publish your app as a binary executable ("self-contained") application with this command:

dotnet publish -r win7-x64

like image 174
Daniel Grim Avatar answered Mar 18 '26 22:03

Daniel Grim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!