简体   繁体   中英

TFS 2012 Team Build Get Solution Configuration

We have built a customized TFS build template that builds all the projects in a solution file in their own folders. We have, let's say, two solution-level configurations SOLConf1 and SOLConf2 as well as two project-level configurations PROJConf1 and PROJConf2 . In the Build Definition , I select a .sln solution file and the SOLConf1 configuration.

Now in the Configuration Manager window, when I select SOLConf1 as the Active Solution Configuration , I see 5 projects selected, and they all have the PROJConf1 configuration. So far so good.

We have modified the project files so that the TFS Team Build output directory is customized:

 <PropertyGroup>
   <_PackageTempDir>
      $(TeamBuildOutDir)\$(SolutionName)\$(Configuration)\$(MSBuildProjectName)            
   </_PackageTempDir>
 </PropertyGroup>

I would expect $(Configuration) to return the solution-level configuration (ie SOLConf1 ), instead, it returns the project-level configuration (ie PROJConf1 ). I couldn't find a property from the list of MSBuild Reserved and Well-Known Properties that would give the solution-level configuration. Inside the template, the variable passed in to MSBuild for configuration is called platformConfiguration.Configuration , which is the configuration I selected in the build definition (ie SOLConf1 ).

Now my question is: is there a way to get this variable using MSBuild macros, such that I will have something like

$(TeamBuildOutDir)\$(SolutionName)\$(platformConfiguration.Configuration)\$(MSBuildProjectName)

If not, how would one access the solution-level configuration inside MSBuild using MSBuild macros?

We have built a customized TFS build template that builds all the projects in a solution file in their own folders.

This is a common issue with many possible solutions. When I ran into this problem I used the advice on this blog , but with .NET 4.5 this is handled via an MsBuild property.

/p:GenerateProjectSpecificOutput=true 

I really love avoiding having to edit the TFS Build Templates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM