1

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?

Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
  • I can't think of anything that doesn't involve hacking around in the template XAML. – DaveShaw Aug 20 '13 at 13:06
  • Do you have a custom MSBUILD script that you are working with? While I was working with TFS2008 (the TFSBuild.proj msbuild scripts directly) we had a similar issue to tackle. What we did that time was we edited the TFSBuild.proj file to add additional MSBUILD properties (eg: target_proj1, publishDir_proj1, Target_proj2 etc) this was passed in during the build. Then within the MSBUILD script based on project being compiled we would pass the appropriate properties to the MSBUILD.exe call. – Isaiah4110 Aug 20 '13 at 13:43
  • IIRC TFSBuild.proj files were replaced by WF Xaml files in 2010. I stand to be corrected on that. – Paul Michaels Aug 20 '13 at 14:38
  • Yes they were replaced with WF XAML in 2010, that's why I said when I "was". If you are using XAML, then like DaveShaw mentioned, you will have to hack around with the XAML to accomodate your needs. – Isaiah4110 Aug 20 '13 at 17:37

2 Answers2

1

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
suresh2
  • 1,129
  • 2
  • 15
  • 25
  • I didn't realise yu could configure publish profiles for non-web apps. How would I go about this? – Paul Michaels Aug 22 '13 at 13:41
  • Sorry. I didn't Realize that you are are using Non-web apps. You can't add Publish profiles to Non-Web Apps. I think in your case, you need custom templates or you can try this method http://blog.stangroome.com/2011/09/06/queue-another-team-build-when-one-team-build-succeeds/ – suresh2 Aug 22 '13 at 14:24
  • Not exactly what I wanted, but it did save me some work trying to change the build definition myself (and it worked) - thanks – Paul Michaels Aug 23 '13 at 13:05
1

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.

Isantipov
  • 19,491
  • 2
  • 26
  • 41