如何告诉 TFS 部署包含在一个解决方案中的多个 web 应用程序? [英] How to tell TFS to deploy multiple webapps containing in one solution?

查看:32
本文介绍了如何告诉 TFS 部署包含在一个解决方案中的多个 web 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个单一的解决方案,其中包含一个 webapp 项目和一些附带项目.我们的 TFS 2010 每天晚上都在构建此解决方案并将 web 应用程序部署到 IIS 服务器.它像微风一样奔跑.

We have a single solution which contains one webapp project and some accompanying projects. Our TFS 2010 is building this solution every night and deploys the webapp to an IIS server. It runs like a breeze.

在 TFS 构建定义的进程选项卡中,您可以指定MSBuild 参数".这是在我们的构建定义中设置的值(全部在一行中):

In the Process tab of the TFS build definition you can specify the "MSBuild Arguments". This is the value which is set in our build definition (all in one line):

/p:DeployOnBuild=True 
/p:DeployTarget=MsDeployPublish 
/p:CreatePackageOnPublish=True 
/p:MSDeployPublishMethod=WMSVC
/p:MSDeployServiceUrl=<service url of IIS> 
/p:DeployIisAppPath="<a website>" 
/p:UserName=<domain><user 
/p:Password=<password> 

这篇博文解释了整个设置:http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html.

This blog post explains the whole setup: http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html.

到目前为止,一切都很好.

So far, so good.

现在我们添加了第二个 webapp 项目,我们希望每晚也将其部署到同一个 IIS.不幸的是,在这种情况下,设置不适用.TFS 只部署一个 webapp.

Now we have added a second webapp project which we want to be deployed also to the same IIS every night. Unfortunately in this case the setup is not applicable. The TFS deploys only one webapp.

其他人也有同样的问题:

There are others with the same problem out there:

TFS 2010 + MSDeploy 当解决方案具有多个 Web 应用程序时

WebDeploy 部署多个网站

Vishal R. Joshi 建议为每个 webapp 项目添加一些属性.现在,发布版本将为每个定义了以下属性的 webapp 项目生成 webpackage(zip 文件):

Vishal R. Joshi suggests to add some properties to each webapp project. Now the release build will generate the webpackage (zip file) for each webapp project which has the following properties defined:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DeployOnBuild>True</DeployOnBuild>
    <DeployTarget>Package</DeployTarget>
    <CreatePackageOnPublish>true</CreatePackageOnPublish>
</PropertyGroup>

好的.但是如何带上TFS把每个webapp部署到IIS上呢?还有其他想法吗?

Ok. But how to bring the TFS to deploy each webapp to the IIS? Any other ideas?

推荐答案

正如 Vishal 在您链接到自己的博客文章中所述,所有 MSBuild 参数都可以在 csproj 中移动.这意味着每个项目都可以有自己的设置.

As Vishal describes in the blog article you linked to yourself, all the MSBuild paramaters can be moved inside the csproj. This then means each project can have its own settings.

我有一个包含 6 个项目、4 个类库和 2 个 Web(WCF 和 MVC 应用程序)的解决方案.我遵循 Vishal 博客中的指令,并简单地将我所有的 MSBuild 参数移动到每个 csproj 文件中..即

I have a single solution with 6 projects, 4 class libraries and 2 web (WCF and MVC app). I followed the directive from Vishal's blog and simply moved all my MSBuild paramaters into each csproj file.. i.e.

  <PropertyGroup>
    <DeployOnBuild>True</DeployOnBuild>
    <DeployTarget>MsDeployPublish</DeployTarget>
    <CreatePackageOnPublish>True</CreatePackageOnPublish>
    <MSDeployPublishMethod>InProc</MSDeployPublishMethod>
    <MSDeployServiceUrl>localhost</MSDeployServiceUrl>
    <DeployIisAppPath>Dev.AuzzyWeb</DeployIisAppPath>
    <UserName>Username</UserName>
    <Password>Password</Password> 
    ...

确保然后从构建定义中删除参数.

Make sure you then remove the paramaters from the build definition.

TFS 然后按预期部署......每个项目到指定为每个 IIS 站点的主目录的正确文件夹中.

TFS then deploys as expected.. each project into the correct folder specified as the home directory for each IIS site.

另外值得注意的是,您不能像上面那样在 PropertyGroup 中包含 DeployIisAppPath,而是使用项目的属性页面为每个构建配置指定它.(右键单击每个项目 > 属性 > 打包/发布 Web).

Also its worth noting that you can not include the DeployIisAppPath in the PropertyGroup as above but use the project's properties page to specify this for each build configuration. (Right Click on each project > Properties > Package/Publish Web).

这篇关于如何告诉 TFS 部署包含在一个解决方案中的多个 web 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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