I want to build a .NET Core project as a EXE and not a DLL so it can be executed.
The answer here did not work: How to run a .Net Core dll?
Here is the sample code:
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Here is my project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": "dnxcore50"
}
}
}
I'm currently using VSCode, whenever I build the project with the build task, or run dotnet restore
I just get a .dll
in my bin/Debug
folder.
How do you build a .NET Core application as an exe?
Bonus: I do, will that run on a mac or other device?