在Visual Studio 2015的构建中自动发布Web应用程序 [英] Automatically publish web application on build from Visual Studio 2015

查看:73
本文介绍了在Visual Studio 2015的构建中自动发布Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在成功构建时,是否有任何方法可以使用预先创建的发布配置文件自动发布Web应用程序?我不需要单击发布图标,而无需在使用宏的情况下在Visual Studio 2015上成功构建Web项目时进行此操作.

Is there any way to automatically have a web application published using a pre-created publish profile on successful build? I don't want to have to click the publish icon, need this to happen on successful build of the web project, on Visual Studio 2015 - without using macros.

任何样品都将不胜感激!

Any samples would be appreciated!

推荐答案

将以下内容添加到您的项目文件中:

Add the following to your project file:

<Target Name="AfterBuild">
  <MSBuild Condition="'$(DeployOnBuild)'!='true'" Projects="$(MSBuildProjectFullPath)" Properties="DeployOnBuild=true;PublishProfile=Local;BuildingInsideVisualStudio=False"/>
</Target>

PublishProfile 的值(在上面的示例中为 Local )是您要运行的发布配置文件的名称.

The value of PublishProfile (Local in the example above) is the name of the publish profile you want to run.

来源:
https://www.dotnetcatch.com/2017/03/24/publish-webdeploy-automatically-with-vs-build/
https://stackoverflow.com/a/41830433/90287

这篇关于在Visual Studio 2015的构建中自动发布Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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