如何自定义TFS DefaultTemplate.xaml,默认设置MSBuildArguments参数
Let’s get this sorted so you don’t have to manually punch in those MSBuild arguments every time you create a new XAML build definition. Here’s a step-by-step breakdown:
Step 1: Grab the DefaultTemplate.xaml file
Head over to your TFS team project’s Build Process Templates library (usually underTeam Project > Builds > Process Templates). Download theDefaultTemplate.xamlto your local machine. Pro tip: make a backup of the original template first—better safe than sorry if something goes sideways.Step 2: Open the template in Visual Studio
Launch Visual Studio (ensure you have the TFS Build tools installed; they’re included with full VS installations). Open the downloadedDefaultTemplate.xamlfile—this will fire up the Workflow Designer.Step 3: Update the MSBuildArguments default value
- In the Workflow Designer, open the Arguments panel (find it in the right-hand toolbar, or via
View > Other Windows > Arguments). - Scroll through the argument list until you spot
MSBuildArguments—it’s usually grouped under the "Advanced" process parameters. - Select
MSBuildArguments, then check the Properties window (bottom-right corner of VS). Locate the DefaultValue property. - Set the DefaultValue to exactly this:
/p:DebugType=pdbOnly;Configuration=Release - Save your changes to the XAML file.
- In the Workflow Designer, open the Arguments panel (find it in the right-hand toolbar, or via
Step 4: Upload the modified template back to TFS
Return to your TFS team project’s Build Process Templates library. Upload the editedDefaultTemplate.xaml—you can replace the original if you want it to be the new default, or upload it as a separate template if you want to keep the original intact.Step 5: Test it out
Create a new XAML build definition and select your modified DefaultTemplate.xaml. Navigate to the Advanced settings section—you’ll seeMSBuildArgumentsalready populated with your desired value, no manual typing required!
A quick heads-up: If your team uses multiple build templates, double-check that this modified version is set as the default for new build definitions in your TFS project’s build settings.
内容的提问来源于stack exchange,提问作者Dhurva




