在构建时自动部署Web应用程序 [英] Automatically deploy web application on build

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

问题描述

为了优化我们的构建过程,我想在构建Web应用程序时自动部署它。部署是"FileSystem",这意味着构建的Web应用程序必须部署在同一台机器上的不同文件夹中。这应该是
在visual studio和构建服务器上工作。 Visual Studio具有"发布"功能。部署Web应用程序的功能,但我们的解决方案有许多Web应用程序,我们希望在构建时部署所有这些应用程序而不是一个接一个地手动部署。
此外,构建服务器应在构建过程中自动部署所有Web应用程序。我试图通过注入"DeployOnBuild"来欺骗构建过程。和"PublishProfile"在"BeforeBuild"中目标,但
它不起作用。有没有办法在构建后始终部署Web应用程序?

< Target Name =" BeforeBuild"> 
< PropertyGroup>
< DeployOnBuild> true< / DeployOnBuild>
< PublishProfile> $(ConfigurationName)< / PublishProfile>
< / PropertyGroup>
< / Target>

解决方案

< blockquote>

嗨spamme1,


这是一个msbuild脚本,它将编译,打包(使用web.config转换),并将输出复制到我的登台服务器

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?> 
< Project DefaultTargets =" Build"的xmlns = QUOT; HTTP://schemas.microsoft.com/developer/msbuild/2003">
< PropertyGroup>
<配置条件=" '


(配置)'==''">发布< /配置>
< SolutionName> MySolution< / SolutionName>
< SolutionFile>


(SolutionName).sln< / SolutionFile>
< ProjectName> MyProject< / ProjectName>
< ProjectFile>


To optimize our build process I want to deploy automatically the web application when they are built. The deploy is "FileSystem", which means that the built web application has to be deployed in a different folder on the same machine. This should work in visual studio as well as on the build server. Visual studio has the "Publish" function, which deploy a web application, but our solution has many web applications and we want to deploy all of them on build and not one after the other by hand. Also the build server should deploy all the web applications automatically during the build process. I was trying to cheat the build process by injecting the "DeployOnBuild" and "PublishProfile" in the "BeforeBuild" target, but it doesn't work. Is there a way to deploy always a web application after building?

<Target Name="BeforeBuild">
  <PropertyGroup>
    <DeployOnBuild>true</DeployOnBuild>
    <PublishProfile>$(ConfigurationName)</PublishProfile>
  </PropertyGroup>
</Target>

解决方案

Hi spamme1,

Here is an msbuild script that will compile, package (with web.config transformation), and copy the output to my staging server

<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <Configuration Condition=" '


(Configuration)' == '' ">Release</Configuration> <SolutionName>MySolution</SolutionName> <SolutionFile>


(SolutionName).sln</SolutionFile> <ProjectName>MyProject</ProjectName> <ProjectFile>


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

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