Solution-Specific Output Directories in Visual Studio 2008 (Orcas)


In an earlier post I described how one can, in Orcas, preserve the output directory structure used in a standard IDE or desktop build.  It seems that many people are looking for a simple approach, however, to augmenting the standard Team Build output directory by putting the outputs of individual solutions into individual subfolders (I get emails about this pretty regularly).  For this simple case, there is a correspondingly simple solution.  In your TfsBuild.proj file, just replace:

    <SolutionToBuild Include=$(BuildProjectFolderPath)/../../Directory/Solution1/Solution1.sln>
<
Targets></Targets>
<
Properties></Properties>
</
SolutionToBuild>
<
SolutionToBuild Include=$(BuildProjectFolderPath)/../../Directory/Solution2/Solution2.sln>
<
Targets></Targets>
<
Properties></Properties>
</
SolutionToBuild>

…with:

    <SolutionToBuild Include=$(BuildProjectFolderPath)/../../Directory/Solution1/Solution1.sln>
<
Targets></Targets>
<
Properties>OutDir=$(OutDir)Solution1\</Properties>
</
SolutionToBuild>
<
SolutionToBuild Include=$(BuildProjectFolderPath)/../../Directory/Solution2/Solution2.sln>
<
Targets></Targets>
<
Properties>OutDir=$(OutDir)Solution2\</Properties>
</
SolutionToBuild>

Note that this uses the new ability in Team Build 2008 to pass custom properties into each solution when it is built.  As shown in this earlier post, you can also call custom targets for each solution using the Targets metadata also shown in this example.


Comments (5)

  1. Aaron, these are absolutely great.  I really love this new feature after I found it!

    Should the OutDir property have a trailing slash on it?  I believe you get an error if you don’t have a trailing slash.  So I think it should be this instead:

    <Properties>OutDir=$(OutDir)Solution1</Properties>

    Ed B.

  2. Garry Trinder says:

    Whoops – that’s right, Ed, thanks for the heads up.  I’ll modify the post.

    -Aaron

  3. .NETicated says:

    Just checked the reports in FeedDemon, and I think it&#39;s only fair that if you haven&#39;t blogged

  4. subhash says:

    CustomizableOutDir is set true ,is removing _publishdwebsite.

  5. Subhash says:

    CustomizableOutDir  is set true  and it is working fine for windows service and console application, and it is creating separate build folder,

    and it is removing _publishedwebsite.plz help me how to solve this.