从VS 2017发布.net核心应用

问题描述:

我正在Visual Studio 2017 Community Edition下创建一个新的解决方案,它主要是.net核心Web应用程序.

I am creating a new solution under Visual Studio 2017 Community Edition, it's mainly a .net core web application.

它可以完美运行,完全没有问题,但是我们希望将其部署到Debian机器上并且可以独立运行,因此我们在项目中添加了运行时标识符.到目前为止,到目前为止,问题是当我们要为我们拥有的任何平台发布应用程序(到目录)时,无法选择指定目标平台,并且创建的发布文件仅仅是.net程序集,本机模块.

It works perfectly, no problem at all, but we want to deploy it to a Debian machine and to be self contained, so we added the runtime identifiers to the project. So far so good, the problem comes when we want to publish the application (to a directory) for any of the platforms we have, there is no option to specify the target platform and the publish files created are just the .net assemblies, no native modules.

当然,如果我们使用dotnet publish -r (platform),它可以按预期工作,它将创建正确的平台文件,并且一切似乎都正常,但是必须转到命令行对其进行编译非常烦人.

Of course if we use dotnet publish -r (platform) it works as expected, it creates the correct platform files and everything seems to be ok, but is very annoying to have to go to command line to compile it.

问题是,如何使用Visual Studio 2017发布针对具体平台的独立应用程序?甚至有可能还是仍然没有?

So the question is, how can be published a self-contained application for a concrete platform using Visual Studio 2017? Is it even possible or this is still missing?

当前VS2017不会执行此操作,因此您必须转到命令行并运行它.

Currently VS2017 won't do this so you have to drop to the command line and run this.

dotnet publish -c release -r ubuntu.14.04-x64

显然是用ubuntu取代了您的debian风格.

Obviously replacing ubuntu for your debian flavour.

这也位于我的csproj文件中,您可能也需要它.

Also this is in my csproj file and you might need it too.

<OutputType>Exe</OutputType>