How to parameterize the DeployIisAppPath Msbuild argument in Tfs Build

I am using Tfs 2012 to build / deploy Asp.Net web applications. We have a build definition that builds 5 solutions (.sln files). Here's what our MsBuild arguments look like:

/p:DeployOnBuild=True /p:AllowUntrustedCertificate=True /p:DeployIisAppPath="Test"         /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl="https://{server}:8172/msdeploy.axd" /p:UserName="{user}" /p:Password="{password}"

I need to deploy all 5 sites using Web Deploy using this build definition. They share all the parameters, except, of course, DeployIisAppPath. It works for 1 solution, but for more than 1, I need to enter a different DeployIisAppPath for each solution so that each one is deployed to the correct site in IIS.

I checked these questions and other documentation, but have not had time yet:

Running build against multiple projects with different build arguments

Continuous deployment with multiple website designs in solution

How to pass a TFS variable to a project MSBuild task

TFS2010 Defining an assembly for deployment to multiple servers?

I tried passing arguments as properties of {siteName} .Web.csproj for each sln as properties too.

Any help would be appreciated.

+4
source share
2 answers

One possible way to do this is to create your own set of parameters. Say we call them DeployIisAppPath_One, DeployIisAppPath_Twoetc. Whatever names work for you, as long as they are unique.

Then do a little editing in each project file that you want to deploy. In the very first section, <PropertyGroup>add the following line. For instance. in the first project add

<DeployIisAppPath Condition="'$(DeployIisAppPath_One)' != ''">$(DeployIisAppPath_One)</DeployIisAppPath>

In the second draft, simalarly:

<DeployIisAppPath Condition="'$(DeployIisAppPath_Two)' != ''">$(DeployIisAppPath_Two)</DeployIisAppPath>

, . :

msbuild ... /p:DeployIisAppPath_One="MySite/one" /p:DeployIisAppPath_Two="MySite/two" ...
+5

- . :

/p:DeployOnBuild=True
/p:PublishProfile=Development
/p:Password=password-of-your-deploy-user-as-earlier-entered-with-publish-profile

/p: PublishProfile, . , , MSBuild ( "" ) -.

: http://www.johandorper.com/log/publish-multiple-webprojects-on-build

, !

+1

Source: https://habr.com/ru/post/1545325/


All Articles