locked
TFS Build/MSBuild 2010 bin folder auto redirection to binaries folder not redirecting all projects RRS feed

  • Question

  • Hi Folks

    I have TFS2010 build workflow that compiles our solution which contains ~100 projects. Compilation is successful, tests run as expected etc. The issue I have relates to the redirection of the bin output folders.

    As I understand it, the TFS2010 build activity for MSBuild redriects your bin folder output to a binaries folder at the the same level as the Sources and TestResults folders as shown below.

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Binaries

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\TestResults

    This redirection of the bin folder works as expected for 80% of my projects. The remaining projects bin folders appear unredirected in their standard location as if I was compiling using VS on a local machine.

    To illustrate, when working as expected...

    Source path:-

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.Modules.Interaction.Specs

    Bin output succesfully redirected to the binaries folder :-

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Binaries\Mixed Platforms\Debug\MyPlatform.Modules.Interaction.Specs

    and now a non redirected example...

    Source path :-

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.AddIns.Framework.Services

    Bin output not redirected and remains in the source folder:-

    C:\Builds\1\MyPlatform\MyPlatform Main - CI\Sources\Source\MyPlatform.AddIns.Framework.Services\bin\Debug

    To clarify, this is not an issue with the drop location but the redirection of bin output to the intermediate Binaries folder. The copy to my final drop location works as expected, all be it minus the projects whos bin output wasn't initially redirected to the binaries folder.

    I've had a good look around and all information I've seen points towards customising the output to the binaries folder or relates to the drop location. Having read this, I can't see anything that should cause some projects to ignore the default redirection.

    Most of my projects are standard .NET 4 class libraries although there are a couple of c++ projects and a WIX installer. I initially though it would be related to this difference but this problem is occuring on several .NET 4 class libraries that have identical settings to all the other projects that redirect successfully.

    One more point about the example paths above. I've substituted "My" for actual project prefixes but otherwise paths are as used.

    Does anyone know why some projects bin output might not be redirected?

    Any help you can offer would be appreciated.

    Thanks H

    Tuesday, September 25, 2012 2:35 PM

Answers

  • Hi,

    In TFS 2010, by default it overwrites build output directory to be “[DriveLetter]:\[BuildAgent]\...\Binaries\...” folder. Now this behaviour can be changed by opening your Build Definition (XAML file) in an xml editor and finding OutDir="[outputDirectory]" phrase in there. You will find it in two different locations. One will be in MSBuild task for clean and one for MSBuild task for compilation.

    If you simply remove OutDir="[outputDirectory]" parameter from both this occurrences then in effect you are telling TFS Build agent to stop over-writing build output directory and instead use the default as specified in the csproj file.

    Verify that in your build definition you are able to see OutDir="[outputDirectory]" phrase and if you can’t then it will be ideal to add it into “<mtbwa:MSBuild ….>” element.

    See http://blogs.msdn.com/b/jimlamb/archive/2010/04/13/customizableoutdir-in-tfs-2010.aspx for more details.

    Secondly, for those project where output is going into your source folder instead of Binaries folder, open those .csproj file in notepad and verify that you don’t have any entries for “CustomizableOutDir” property. This method was used prior to introduction of TFS 2010 Build process templates to overwrite output folder to different location then the default location of Binaries on build agent. 

    I hope this helps you resolve your situation and if it does then please mark this reply as answer.

    Best Regards,
    Dharmesh Shah.

    Wanted to automatically generate release notes from TFS ... Why not look at  http://tfschangelog.codeplex.com
    • Marked as answer by Horatio1 Wednesday, September 26, 2012 9:00 AM
    Tuesday, September 25, 2012 6:45 PM
  • Hi Dharmesh

    The link you provided above has lead me to the solution.  Whilst All the OutDir settings etc were as they should be I notied our build definition had a refernece to TeamBuildOutDir mentioned in the article you linked.  Some of our projects contained the following entry which tied it all together.

     <PropertyGroup Label="OutputPathLabel">
        <OutputPath Condition="'$(TeamBuildOutDir)'=='' ">bin\$(Configuration)\</OutputPath>
        <OutputPath Condition="'$(TeamBuildOutDir)'!='' ">$(TeamBuildOutDir)\$(MSBuildProjectName)\ </OutputPath>
      </PropertyGroup>

    Many thanks for your time and help

    H

    Wednesday, September 26, 2012 9:00 AM

All replies

  • Hi,

    In TFS 2010, by default it overwrites build output directory to be “[DriveLetter]:\[BuildAgent]\...\Binaries\...” folder. Now this behaviour can be changed by opening your Build Definition (XAML file) in an xml editor and finding OutDir="[outputDirectory]" phrase in there. You will find it in two different locations. One will be in MSBuild task for clean and one for MSBuild task for compilation.

    If you simply remove OutDir="[outputDirectory]" parameter from both this occurrences then in effect you are telling TFS Build agent to stop over-writing build output directory and instead use the default as specified in the csproj file.

    Verify that in your build definition you are able to see OutDir="[outputDirectory]" phrase and if you can’t then it will be ideal to add it into “<mtbwa:MSBuild ….>” element.

    See http://blogs.msdn.com/b/jimlamb/archive/2010/04/13/customizableoutdir-in-tfs-2010.aspx for more details.

    Secondly, for those project where output is going into your source folder instead of Binaries folder, open those .csproj file in notepad and verify that you don’t have any entries for “CustomizableOutDir” property. This method was used prior to introduction of TFS 2010 Build process templates to overwrite output folder to different location then the default location of Binaries on build agent. 

    I hope this helps you resolve your situation and if it does then please mark this reply as answer.

    Best Regards,
    Dharmesh Shah.

    Wanted to automatically generate release notes from TFS ... Why not look at  http://tfschangelog.codeplex.com
    • Marked as answer by Horatio1 Wednesday, September 26, 2012 9:00 AM
    Tuesday, September 25, 2012 6:45 PM
  • Hi Dharmesh

    The link you provided above has lead me to the solution.  Whilst All the OutDir settings etc were as they should be I notied our build definition had a refernece to TeamBuildOutDir mentioned in the article you linked.  Some of our projects contained the following entry which tied it all together.

     <PropertyGroup Label="OutputPathLabel">
        <OutputPath Condition="'$(TeamBuildOutDir)'=='' ">bin\$(Configuration)\</OutputPath>
        <OutputPath Condition="'$(TeamBuildOutDir)'!='' ">$(TeamBuildOutDir)\$(MSBuildProjectName)\ </OutputPath>
      </PropertyGroup>

    Many thanks for your time and help

    H

    Wednesday, September 26, 2012 9:00 AM