我想将.NET Core项目构建为EXE而不是DLL,以便可以执行。
这里的答案没有起作用:如何运行.NET Core dll?
这是示例代码:
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
这是我的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"
}
}
}
我目前正在使用VSCode,每当我使用构建任务构建项目或运行dotnet restore
时,我只会在我的bin/Debug
文件夹中得到一个.dll
文件。
如何将.NET Core应用程序构建为exe文件?
奖励问题:如果我这样做了,它能在Mac或其他设备上运行吗?