Visual Studio和自包含部署 [英] Visual Studio and Self Containing Deployments

查看:88
本文介绍了Visual Studio和自包含部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试发布使用Visual Studio自行包含部署。我可以通过以下方式使用CLI轻松实现这一点:

I'm trying to publish self containing deployment using Visual Studio. I can easily achieve that using CLI by running:

dotnet new mvc --auth None --framework netcoreapp1.1            
dotnet restore --runtime win81-x64      
dotnet build
dotnet publish -c release --runtime win81-x64    

此命令将创建新的mvc应用程序,恢复win81-x64运行时的所有库并将其发布。因此,部署将包含作为应用程序一部分的.net core 1.1 / win81-x64平台的运行时。这样,我可以将其安装在未预安装.net core 1.1的服务器上。

This commands will create new mvc application, restore all libraries for win81-x64 runtime and will publish it. As a result deployment will contain runtime for .net core 1.1 / win81-x64 platform as part of the application. This way I can install it on the server where .net core 1.1 is not pre-installed.

我的问题是如何使用Visual Studio 2017发布UI实现该目标?如果我进行简单发布,它将不包含.net核心运行时文件。

My question is how can I achieve that using Visual Studio 2017 publish UI? If I do simple publish it will not include .net core runtime files.

谢谢!

推荐答案

不幸的是,此功能(在发布过程中选择运行时)并未纳入VS 2017 RTM版本。我们计划在将来的版本中添加它。

Unfortunately, this feature (picking a runtime during publish) didn't make it into the VS 2017 RTM release. We plan on adding it in a future release.

现在,要解决不具有该功能的问题,可以添加< RuntimeIdentifier> 属性添加到您的.csproj。

For now, to work around not having the feature, you can add the <RuntimeIdentifier> property to your .csproj.

<PropertyGroup>
  <TargetFramework>netcoreapp1.1</TargetFramework>
  <RuntimeIdentifier>win81-x64</RuntimeIdentifier>
</PropertyGroup>

现在,当您发布它时,它将在该运行时独立发布。

Now when you publish it will publish standalone for that runtime.

如果要发布不带.net核心运行时文件的应用,则需要删除此属性。如果您要为其他运行时发布,则可以更改该值。

You will need to remove this property when you want to publish your app without the .net core runtime files. And you can change the value if you want to publish for a different runtime.

这篇关于Visual Studio和自包含部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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