Visual Studio XAML Build Process Template - Get Comment - visual-studio

I'm currently creating a custom build process template as part of a Team Foundation Build definition, using Visual Studio 2013.
The builds are set to 'Continuous Integration - Build each check-in' as their trigger, and I'm looking to get some information about the check-in once the build starts running.
So far, I can get the following:
Build number using: Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BuildNumber
Changeset ID using: Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.SourceGetVersion
These have both been retrieved using 'GetEnvironmentVariable' from the list of 'Team Foundation Build Activities'.
What I need now is the comment associated with that changeset. So the comment I set during the check-in that triggered the build.
Is this possible?

Related

Integration Build column is not being updated after a TFS build

I have created a web TFS build like the image below.
After I have successfully build my application, the Integration Build column is not being updated and the changesets are not being populated in the email notification.
I'm using TFS 2015.
It's not be updated in Integrated in Build field in TFS 2015 Server with vNext build, only XAML build number will be updated in this field. This has been a uservoice for the vNext build.
vNext builds should update work items with Integration Build field value
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/12836916-vnext-builds-should-update-work-items-with-integra
As a workaround you could add a custom build task to implement it yourself: Build association with work Items in vNext
And for the changesets are not being populated in the email notification. There's also a uservoice. The changeset data and the associated work items don't seem to be exposed to default BuildCompletedEvent.xsl. For more info you could take a look at my answer in this question: TFS 2017 Build Notifications do not include "Associated Changesets" area

Associate changeset made within a TFS build to the build

I have a TFS build that runs on a schedule. Within the build process I have a step that checks out that project's properties file, increments the assembly's version number, then checks in the file bypassing any gated check-ins. This is creating a problem as the check-in of the properties file automatically sets the scheduled build to run the next day, causing an infinite loop.
My question is, is there a way to associate changesets made within the build process to the current running build?
I've tried refreshing the build detail and re-associating changesets after the msbuild compiles the project, but before the build finishes, without success.
Our projects are for Visual Studio 2010 and we are running against TFS 2013.
EDIT 12/21/15: For clarification:
I know about the NO_CI for bypassing CI Builds and including the /bypass in the command line. Overall my check-in that I am doing looks like the following:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe" Checkin %My_FILE% /comment:"***NO_CI*** Version Updated to %NewVersion%" /noprompt /bypass
I"m having trouble with scheduled builds kicking off, because my check-in is telling it that there is a changeset to build.
You need to check in without triggering the build.
To tell the build system to ignore the check-in operation, a check-in comment value***NO_CI*** is specified to indicate "No Continuous Integration" meaning "please don't start a CI build because of this check in". Place the following into the comment field:***NO_CI***and when you check-in TFS will not kick off a build. More details for your reference: http://bartwullems.blogspot.hk/2012/08/tfs-do-check-in-without-triggering.html
update
You could customize your build template and add in the custom TFSVersion activity from the TFS Community Build Extensions that will handle this. Detailed steps for your reference:http://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20TfsVersion%20build%20activity&referringTitle=Documentation

How do you trigger a build when you check in code using VSO and visual studio 2013?

I am developing using Visual Studio 2013 with Visual Studio Online for source control. I want to prevent check-in if the build that is triggered is returned false. Using the steps below, don't see how the builds are happening and not sure how to enforce good check-ins?
I completed the following steps:
https://www.visualstudio.com/en-us/get-started/build/build-your-app-vs
Since you are using TFVC the. You would need to use Gated Build as the trigger. Unfortunately Gated Build has not yet been implemented on the new Build system and is only available on the legacy Xaml builds.
If you were using Git you could take advantage of the Branch Policies to require that a build succeed before a checkin was allowed through Pull Requests.
You can either change your source control to Git and use Pull Requests, or you could change your build system to the Xaml builds and use Gated Build.

Visual Studio Scheduled Build Trigger

I am using the new Visual Studio build definitions on Visual Studio Online under Build. I would like to run a scheduled build every day for the branch TestingBuildDefinitions1 only if there have been changes in the branch since the previous build.
I cannot find the option to run scheduled builds only if there have been changes. The MSDN documentation says there should be a "Build even if nothing has changed since the previous build" checkbox. However, the new screen does not have this checkbox.
The documentation is referring to the old Xaml based builds, while the UI you are using is for the new VSO Build vNext, which does not have the functionality you are looking for.
If you want to create a new Xaml based build, you will need to do it from the Visual Studio client (it cannot be done from the portal).
Start by clicking on Builds in Team Explorer

TFS Check-In Enhancements

I want to write a Visual Studio Plugin that will extend the functionality of Check-In command. What I want to happen is when a check in happens, I should be able to call an external program.
There are a few options to trigger a script or action when a user checks in:
1. Check-in policy
A checkin policy triggers in Visual Studio when checking in. The code that triggers is simple C#, so running an application is easy using the Process class.
These policies need to be deployed to the machines running Visual Studio. They will get an error message if the policy is not installed. You can create an MSI or vsix to deploy the policies. Or just copy them to the right folders manually.
2. Automated Build
A CI build or Gated build using a tool like Team Build or Team City would be ideal to run a program or piece of code. This would happen right after (CI) or just before (Gated) the final checkin, but they would run on the build server, not inside Visual Studio.
This can be either a MsBuild task or Team Build Activity.
3. Visual Studio Extension
You can also create a custom Visual Studio extension and then subscribe to the VersionControlServer.BeforeCheckinPendingChange event. This happens just before checkin. You can grab the VersionControlServer from the connected Team Project.

Resources