Archive

Archive for January, 2012

TFS 2010 Build Automation–Different Folders for each VS Project

January 30, 2012 Leave a comment

Problem

My Visual Studio solution contains several projects of different kind (Web Apps, Console Apps, etc.). If you are using single TFS Build definition for all projects, then TFS will place all projects output files into the root of Drop folder. It is very hard to manage the output files.

It would be if TFS placed output files of each project in a separate folder. TFS 2010 don’t have this feature  by default, but there is an workaround with two steps.

Step-1

1.1 Select “Run MsBuild for Project” activity from TFS Build Template Workflow.

image

1.2 Update CommandLineArguments with the following
String.Format("/p:SkipInvalidConfigurations=true /p:TeamBuildOutDir=""{0}"" {1}", BinariesDirectory, MSBuildArguments)

1.3 Clear OutDir property.

Step-2

Update PropertyGroup > Ouputpath in all Project files (.csproj / .vbprog) in the Visual Studio Solution, for each configuration.
image

<OutputPath Condition=" ‘$(TeamBuildOutDir)’==” ">bin\Debug\</OutputPath>
<OutputPath Condition=" ‘$(TeamBuildOUtDir)’!=” ">$(TeamBuildOutDir)\WebApplication3\</OutputPath>

That’s it. Hope it helps.

Categories: TFS