I have a series of projects that need to be compiled and published, deployed to separate directories with separate MSBuild arguments. As it stands, I have separate builds for each. For example, project 1:
MSBuild Arguments: /target:myTarget /property:PublishDir=\\1.1.1.1\PublishDir1
and project 2:
MSBuild Arguments: /target:myTarget /property:PublishDir=\\1.1.1.2\PublishDir2
However I'd like to merge them into a single build. The problem I have is that although TFS will allow me to specify multiple projects in the build, the MSBuild arguments apply to all projects. Is there a quick way I can force a distinct set of build arguments per project, or do I need to create a new build template to do this?
I am afraid, you need new build template to pass additional arguments to the template.
But if you are trying to Publish the build output to different directory based on different Project, you can achieve it by setting up same publish profile for each project. Add publish profile for each Project with same name. you can use File system Publish Method to Publish the output to different directories for each project. Just call the Publish profile in the MsBuild Argument.
/p:DeployOnBuild=true;PublishProfile=Dev
I suggest, that you create an MSBuild .proj
file to execute the builds, i.e.:
<Project ToolsVersion="4.0" DefaultTargets="Rebuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Rebuild" >
<!--Execute proj1-->
<MSBuild Projects="Proj1.csproj" Properties="Configuration=Debug;PublishDir=\\1.1.1.2\PublishDir1;></MSBuild>
<!--Execute proj2-->
<MSBuild Projects="Proj2.csproj" Properties="Configuration=Debug;PublishDir=\\1.1.1.2\PublishDir2;></MSBuild>
</Target>
</Project>
Just point your tfs to this custom .proj
file.