从VS 2017发布.net核心应用 [英] Publish .net core app from VS 2017

查看:118
本文介绍了从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>

这篇关于从VS 2017发布.net核心应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆