如何在 Visual Studio 2017 中创建独立的 .exe DotNetCore WebApi 应用程序?

Jam*_*Law 3 asp.net-web-api .net-core visual-studio-2017

我正在尝试在 Visual Studio 2017 中创建独立的 .exe DotNetCore 1.1 WebApi 应用程序,但是我找不到任何文档。

此处的 Microsoft 文档: https: //learn.microsoft.com/en-us/dotnet/articles/core/deploying/deploy-with-vs仅涵盖控制台应用程序,并且对 .csproj 的修改不会改变任何事物。

<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
Run Code Online (Sandbox Code Playgroud)

有人有什么想法吗?

Jam*_*Law 7

好吧,经过一番挖掘,我已经弄清楚了。

在 .csproj...

<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
<OutputType>Exe</OutputType>
Run Code Online (Sandbox Code Playgroud)

然后...

PM> dotnet restore
PM> dotnet publish -c release -r win10-x64
Run Code Online (Sandbox Code Playgroud)

检查bin/Release/win10-x64目录,您的独立应用程序将在那里。邦扎。