vNext Build and Release Manager - tfs

We are using TFS 2015. I'd like to create a build and then trigger a release (with RM). We have a webproject and a wpf app. Inside of the code we have compiler directives (#if DEBUG). And the config transformation has to be executed.
My approach was to create a build for Debug and Release, publish it and copy it to a drop folder.
Can anyone tell me what is the best way to achieve this?
Thank you in advance.

If you want to trigger an agent-based release, you can use a custom build task:
https://github.com/incyclesoftware/build-tasks
(Full disclosure: I created these tasks.)
When you deploy a task-based build, make sure the component in Release Management is named the same thing as the artifact you published in the build.

Related

TFS 2017 Build definition: how to get sources from another TFS

I have two different TFS instances. Both use TFVC as a source control.
I want to set up a build definition on TFS1, so that it gets sources from TFS2. Is it possible to do it?
There is no option "Remote TFVC", only "Remove Git".
Thank you.
As far as I can tell, it isn't supported in either TFS On-Prem, or VSTS. Depending on your needs, circumstances and limitations, you might consider one of the following options (all are more or less trade-offs):
Migrate sources from TFS2 to TFS1 (the one to run builds)
This seems to be the correct thing to do, but it is a time-consuming and error-prone process
Fake the Get Sources action and do the real get/checkout in the first build step
You can configure the Get Sources step to address any Git repo in the same team project, and turn the Don't sync sources flag ON. Then, in the first real build step, run command-line Get (something like this)
You may use custom build step (cmd or bat file) and download files from remote server. Examples:
Copy files from tfs versioncontrol to directory with PowerShell
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9559f7a5-405a-456c-a66b-8123d52ed23a/how-to-copy-a-folder-from-tfs-source-control-to-shared-location-with-powershell-script?forum=tfsgeneral
You could just add the extension to get them from an external vsts/tfs.
Go to the marketplace and search for them (see image).
You will have to configure a endpoint to your external vsts/tfs, but it is quit easy to do.
You can install this extension: TFS artifacts for Release Management.
Then add a Download Artifacts-External TFVC task from Utility.

Packaging DSC configurations for TFS Release Management vNext

I am trying to grasp Release Management vNext and dsc configuration 'management' (how to manage DSC configuration files). In the 'Deploy Using PS/DSC' dialog box while editing a vNext Release Template
Why is PSScriptPath relative?
Does it really mean, that I somehow have to get my scripts I want to use relative to my current drop folder? What is the best way to do achieve this? I want to be able to do:
Have a separate git repository for configuration files
Reuse configuration files across different projects
I've read a promising article Packaging DSC configurations for Visual Studio / TFS Release Management vNext but it seems to be out dated and some kind of hack from my point of view.
How does Microsoft want us to use this? How to achieve reusable configurations in a separate repository?
Thank you
Use a submodule to your separate configuration repository, then ensure the submodule is initialized during the build. You can then copy the configuration scripts to the build drop folder as part of your build script.
The reasoning is that your deployment scripts will evolve over time, and that evolution should be something that is captured. If you ever need to redeploy an old version of your software, that old version shouldn't be deployed using new scripts -- it should be deployed using the same version it used initially.

How do I link multiple TFS 2012 Build Definitions into a single build definition

How do I or can I, create a hierarchy of build definitions in TFS 2012?
I currently have a master build script (.cmd) that calls multiple child scripts (.cmd).
I want to migrate this to the TFS build system and maintain the hierarchy.
I can't seem to figure out if this is possible using the TFS 2012 build system.
Here's what I'm talking about:
MasterBuildScript.cmd
call componentscript1
call componentscript2
call componentscript3
call ...
call packaging routine for all components
componentscript1.cmd
build solution componenta1
build solution componenta2
build solution componenta3
...
componentscript2.cmd
build solution componentb1
build solution componentb2
build solution componentb3
...
more components...
Is there a way to do this with the standard TFS 2012 Build Definitions?
- Bruce
There is a way to do this without doing any custom coding. You will have to make a minor addition to a build process template, however. That doesn't use code, it uses Windows Workflow Foundation.
Essentially, you would need to setup TFS Team Build definitions for each .cmd build script that you currently have. One for the master build, one for each component build. The real work involved here is converting your .cmd script into a TFS build definition.
Then, to auto queue the "child" builds, you can edit the process template for your master build definition and add an "InvokeProcess" activity - this lets you shell out to the command line as part of the build process. You can use the command line utility TFSBuild.exe to kick off the "child" builds. http://msdn.microsoft.com/en-us/library/aa337622(v=vs.90).aspx
I've used something similar in the past where I have a build for my core set of assemblies. That build then kicks off all of the builds which have dependencies on those assemblies.

Trying to queue build in TFS server - Calling a target in TFSBuild.Proj

I have been using a msbuild file that builds and packages my solution to 'Client' and 'Server'. So far I have been using the below cmd to build from VS cmd prompt:
msbuild.exe MyBuildFile.proj /t:Build
(I have a target called 'Build' which will kick start build and do the rest).
Now, my team wants to queue builds in TFS build server. I read about TFSBuild.proj file. Should I once again write all the scripts in to TFSBuild.Proj or is there a way by which I can call my 'MyBuildFile.proj /t:Build' from TFSBuild.Proj.
Any help is appreciated.
Thanks, Mani
You can just include your existing MyBuildFile.proj in a TFS 2010 build:
Create a new build definition
In the Process page, choose the UpgradeTemplate.xaml workflow
Select the directory of your checked-in MSBuild.proj file of choice (checked-in under the name TFSBuild.proj)
There might be some subtle differences between your development system and the build server that you need to take care of, but above steps should take you 85%. Enable Diagnostic level build information verbosity (also to be set on the Process page) to troubleshoot loose ends.

Team Build to build solution in different TFS Projects

We are using TFS2008 and TeamBuid to build our product. I have SolutionAA in TeamProjectAA that uses a file reference to a compiled library (SolutionBB) that is checked in to TeamProjectAA. Now this works fine. Now the source code to the library is checked in TeamProjectBB. The problem arises when I need to due a full build using TeamBuild. I have a build project for SolutionAA but I need to compile SolutionBB and version is correctly so it can be distributed with our install.
Is there a way to chain two TeamBuilds together? Or can I build a solution from another TFS project from another TFS project?
See this post (http://bit.ly/tfschaining) which contains an example Custom Task which can queue a build.
Your full build can start by running build AA and then queue build BB.
I would suggest, though, that you get a better versioning scheme for your dependencies. You are running AA as if it is an independent project and should treat it's output as such in BB. Consider pulling manually from AA as you it suites your status on BB. That way BB can have intermediate builds and BB can only pull when its ready to take on the changes in AA.
I'd suggest checking in the compiled library as part of the TFS Build for SolutionBB. Then, include the location of that compiled library in your workspace mapping for the TFS Build of SolutionAA and configure it with a continuous integration trigger. The build of SolutionAA will get triggered whenever the compiled library for SolutionBB is modified in version control.

Resources