2
votes

I am trying to pass different MSBuild arguments for two projects in TFS build definition.

I am building a single solution with two projects in it. I am able to pass MSBuild arguments without specifying a projects and it's working. Both projects are building correctly. Now, I want to pass MSBuild arguments separately to both projects because i have different arguments value for both project. I am not able to do that.

If I pass MSBuild arguments as below, common for both project, it's working both project is building correctly.

/p:DeployOnBuild=true /P:PackageTempRootDir=\Release /p:DeployIisAppPath="Default Web Site";DefaultPackageFileName=API.zip /p:OutputPath="$(Build.BinariesDirectory)\$(BuildPlatform)\$(BuildConfiguration)"

If i pass MSBuild arguments separate for both projects,

/t:Project1 /p:DeployOnBuild=true /P:PackageTempRootDir=\Release /p:DeployIisAppPath="Default Web Site";DefaultPackageFileName=API.zip /p:OutputPath="$(Build.BinariesDirectory)\$(BuildPlatform)\$(BuildConfiguration)" /t:Project2 /p:DeployOnBuild=true /P:PackageTempRootDir=\Release /p:DeployIisAppPath="Default Web Site";DefaultPackageFileName=WEB.zip /p:OutputPath="$(Build.BinariesDirectory)\$(BuildPlatform)\$(BuildConfiguration)"

I am only looking for a change in package name based on project as you can see above. for project1 i want API.zip, for project2 i want WEB.zip. I tried to pass it few different ways, it didn't work.

With above agruments i am getting output for both project with same package name and it's WEB.zip. I don't know why. it's building both project but names are same.

I found similar questions specify project file of a solution using msbuild, but it doesn't specify how to pass separate MSBuild agruments to mutliple projects.

1
If you don't find a solution I guess a workaround is to just build the two projects seperately?stijn
Which build are you using? XAML (2010 and later) or vNext (2015 and later)?Giulio Vian
vNext build definition.Meet101

1 Answers

3
votes

Since you are using vNext build, you could build the two projects separately by adding multiple VS build tasks.

enter image description here

For more details you could take a look at below two questions: