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

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

问题描述

我们有一个解决方案,其中包含一个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构建定义的Process选项卡中,您可以指定MSBuild Arguments。这是我们的构建定义中设置的值(全部在一行中):

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-versushtml

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

到目前为止,非常好。

现在我们已经添加了第二个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:

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

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.Auzzy\Web</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部署多个包含在一个解决方案中的webapp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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