问题
I have a pretty large complicated application that has a smart client front end in one solution and a web services layer in another solution. We use 2 team build definitions in TFS 2010 to build the solutions. We are still using MS Build scripts not the new workflow based templates.
How can we use a single build definition to build both solutions. We are open to either tricks inside MS Build scripts or moving to the new workflow templates.
回答1:
You can simply set two Solutions to build by creating them in an item group if I am understanding what you are trying to do
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../$(SuiteSourceBranchRoot)/MyCompany.Suite.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../$(SuiteSourceBranchRoot)/MyCompany.Another.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
</ItemGroup>
You can also do it inside any build step with:
<!-- Build the deployment solution. -->
<MSBuild Projects="$(SolutionRoot)\$(SuiteSourceBranchRoot)/Company.Deployment.sln" Properties="Configuration=Release;" />
回答2:
You can build multiple solutions from a single team build project definition by definitng multiple SolutionToBuild
items in your TFSBuild.proj MSBuild project file.
<ItemGroup>
<SolutionToBuild Include="$(SolutionRoot)\A\A.sln" />
<SolutionToBuild Include="$(SolutionRoot)\B\B.sln" />
</ItemGroup>
You may also have to modify the build definition's workspace mapping to include sources for both solutions.
来源:https://stackoverflow.com/questions/6431177/how-to-build-2-solutions-from-a-single-tfs-team-build-definition