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": {}
}
}
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With