简体   繁体   中英

Easily build a different branch of the same C# project (VS2010/TFS)

I'd prefer to solve this using a Team Build/build definition, but I'm open to other solutions.

Currently, I have a build definition that builds my main branch. If I want to build other branches, what's the easiest way? Do I have to clone and modify the build definition for each branch, or is there an easier and more elegant way?

(Specifically, the build definition builds MSI files, and I'd love to just one-click to build MSI files for any previous release branch.)

MyCollection
|
|-- MyProject
     |
     |-- MainBranch
     |    |
     |    |-- MySolution.sln
     |
     |-- EarlierReleasesFolder
          |
          |-- ReleaseBranch-2012-01
          |    |
          |    |-- MySolution.sln
          |
          |-- ReleaseBranch-2012-02
          |    |
          |    |-- MySolution.sln
          |
          |-- ReleaseBranch-2012-03
          |    |
          |    |-- MySolution.sln
          |
          |-- ReleaseBranch-2012-04
          |    |
          |    |-- MySolution.sln

Using just the default templates that ship with TFS2010, there's no way to change the target solution being built. You have to define the source path of the solution(s) to build as part of your build definition.

Of course, TFS Build is just a WF workflow and fully customizable; if you are so inclined you could clone the default workflow, add a "branch path" parameter, and add a custom task to change the BuildInfo object before going into the MSBuild part of the workflow.

Currently, I'm thinking:

  • Code against the TFS API to automatically create build definitions for each release branch; or:
  • Manually create the build definitions (using Power Tools to be able to clone build definitions)

TFS Power Tools adds a Clone Build Definition menu item. It makes it easy to copy a build def, modify the source control mappings and solutions to build list and you are ready to build.

Since you mentioned building MSI's... I need to understand if you just want to start doing dev off these old releases or if this is a build reproductibility excercise where the goal is to reproduce the MSI exactly? If the answer is the later, you need use static PackageCodes instead of * for random.

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