TFS Build Definition - Can you add this to source control? - tfs

I would like to add my Build Definitions to TFS Source Control. Is there anyway to do this?

Not really, no. If you're trying to track changes to your build definitions, you can use a couple of new commands in the latest releast of the Team Foundation Power Tools. The first compares two build definitions:
tfpt builddefinition /diff
This one exports a build definition's configuration to a text format, which you could then check into version control.
tfpt builddefinition /dump

Another option via powershell
https://gist.github.com/jstangroome/6747950
which basically uses c# types so should be easy enough to make into a linqpad or c# console app (or winforms or wpf)
used assemblies
Microsoft.TeamFoundation
Microsoft.TeamFoundation.Client
Microsoft.TeamFoundation.Build.Client
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Build.Workflow.dll

Related

How to Use different versions of MSBuild for same solution C++

I have a Visual Studio Solution with multiple projects. Few of them are of Visual studio 2017 and few are of Visual studio 2013. The difference is because of the use cases of the projects. Visual studio has the option to select toolset for each project. Now I need to create build through Jenkins using MSBuild. How can I set toolset for projects in MSBuild?
How to Use different versions of MSBuild for same solution C++
First, please make sure that VS2013 and VS2017 are installed in your local agent.
The Platform Toolset from VS IDE is stored in xxx.vcxproj file. It is stores as PlatformToolset xml node.
Like <PlatformToolset>v141</PlatformToolset>
v142 means VS2019, v141 means VS2017, v140 means VS2015, v120 means VS2013
So for your situation, you can just change the PlatformToolset.
Solution
So you can use -p:PlatformToolset=xxx in msbuild command line to specify a specific toolset version to build a project.
Note: this does not permanently change the value in xxx.vcxproj, but uses this specific value when building the project.
1) If you want to build the whole solution,
if you want to use the value in the whole solution(every project uses this toolset), use this:
msbuild xxx.sln -t:build -p:PlatformToolset=xxx
Or if you want to use different toolset for different projects in msbuild command line:
-- change PlatformToolset in every xxx.vsxproj file directly as you want and then build your solution
-- use msbuild script to combine all the projects of your solution and then build this script directly to get what you want. See my answer and change to use <Properties>PlatformToolset=xxx</Properties>.
2) If you want to build the project, you can overwrite the PlatformToolset in command line to specify it.
msbuild xxx.vcxproj -t:build -p:PlatformToolset=xxx

How can I put xaml build definitions in source control in Visual Studio 2015?

I use Visual Studio 2015 and TFS 2012. In Team Explorer, it is possible to manage Builds and Build Definitions. Since VS2015, the section Build Definitions is named "XAML Build Definitions". I would like to put xaml build definitions in source control. Problem is I cannot find the build definition files on disk. Anyone knows where they are ?
Thanks
You can download build process template and add it into source control, but you can't version-control build definitions.
In the new build system coming with TFS 2015 you can see the full history of the changes to your build definition. The feature that is currently missing is the ability to undo or rollback to a previous revision. Check https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/2037625-provide-a-way-to-version-control-build-definitions
Just in case anyone needs to access the XAML Build Definitions parameters. They are saved in the TFS database, table: [dbo].[tbl_BuildDefinition].

Using wildcards in TFS build definition source path

Is there a way to set Source Control Folder path in the build definition in TFS 2013 or TFS 2015 using wildcards?
If you mean the source path is the project path which need to build. As Christian.K mentioned, it's impossible. TFS can't build a few projects at the same time.
If you want to using wildcards in the source control folder path on the Source Settings tab. It's also not support. This one specify the version-control folders that contain the files that your build process requires. You can specify the only folders that contain files that your build process requires to improve performance.
No, it is impossible. This case discusses the same request as yours: Variables in TFS Mappings on Visual Studio Online Team Builds

Using _TEAM_BUILD_ with TFS 2010

We moved from TFS 2008 to TFS 2010.
With TFS 2008 I used _TEAM_BUILD_ in project file const to turn PostBuild event off when building by build server.
Now, when I create build definition with new format, without using tfsbuild.proj, but using Default template, it doesn't seem to work. I have PostBuildEvent running even though I am using same approach.
Any ideas how to achive same functionality, having PostBuildEvent running from Visual Studio and to be ignored on build machine?
Check for BuildingInsideVisualStudio. As you'd suspect, it's only defined when building inside Visual Studio. Alternatively, you could add "/p:_TEAM_BUILD_=1" to the MSBuild Arguments build process parameter of your build definition.

TFS Build 2008 - Why is everything getting dumped in one folder?

When I build my solution, it dumps all the binaries into one folder. How can I cause it to split up the files by project like Visual Studio does?
Just edit your TFSBuild.proj file for the build, and add this to opne of the property groups:
<CustomizableOutDir>true</CustomizableOutDir>
This will automatically then cause the build to output the build output as per normal (like Visual Studio).

Resources