Reconcile Workspace for TFS 2015 vNext Builds - tfs

We used to get notification from the tray of our windows machine for a finished build while using the xaml build definitions, it also had an option to reconcile workspace. The same functionality is not available for the vNext builds.
The BuildNotification App is available with VS 2015, but it seems that the reconcile workspace is not available with the vNext build. Is there some other app that can give a notification and do the reconcile operation?

We just moved to new builds (vNext) and are missing this feature as well.
Currently, we can do this manually via IDE (VS 2015):
Team Explorer -> Builds
Right click on latest build with you changes -> "Reconcile Workspace..."

The BuildNotificationApp is still a part of the VS 2015 and can be found here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\BuildNotificationApp.exe. However, this app only applied to XAML build.
For now, to workaround the missing feature, you can use a free build status tool Catlight . It also shows status of vNext builds in tray area.
As for reconcile workspace, there is no this build-in feature for vNext build. However, you can manually use tf reconcile command for your workspace. Such as below screenshot:
Update:
If you just want a simple app or vs extension to achieve it, there is no these things for now. You may have to customize your own extension to implement it.
Update2:
I have created a feature request in uservoice:
Reconcile Workspace for vNext Build
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/15979690-reconcile-workspace-for-vnext-build

You can use AnyStatus to monitor both vNext and XAML builds.
AnyStatus comes with a feature called Triggers which lets you run a program or a batch script in response to status changes. Using Triggers you can configure it to run "tf.exe reconcile" when the build status changes from Running to OK.
Disclaimer: I am the author of Any Status.

Related

Incremental build in TFS 2017 - How to build only code that has changed from the last build? [duplicate]

When we do a TFS Build, can we alter the build output so that the output is limited to only the changes so that deployment payload is reduced ? Example:
When I build a solution, I should only get the changed dlls not all (which includes Microsoft and other 3rd party dlls which are never changed.
Configure CI solution in TFS 2015, and unchecked clean options, Since TFS 2015/2017 always delivered all files - changed and unchanged, but I need only changed. This trick doesn't solve the issue:
Build (TFS Build), only what is changed
Followed a couple of other sources.
IncrementalBuild property in TFSBuild project
Incremental builds in TFS
Applied these tricks to update project with few settings (IncrementalBuild =True, ForceGet=False, SkipInitilizeWorksplace=True, SkipClean=True) under PropertyGroup definition to the end of the TFSBuild.proj file.
But the issue still persists, we are unable to produce only changed binaries in build folder, there is always all files.
Please help me to achieve the desired build output.
Incremental builds only rebuild assemblies that don't depend on changed files. But it does copy all of the project output (subsequent projects that depend on it may depend on these assemblies and files being there).
This causes incremental builds to be much faster, but it doesn't "only deliver the changed files". It always delivers all files whether they are changed or unchanged. On top of this, you could have multiple agents and each agent can have multiple working folders, the incremental build could use any of these as base for the incremental builds, there is no guarantee that the changed files are between your previous build and the current one.
You'll have to implement this feature yourself, it has never been part of MsBuild or TFS Build. It would involve querying TFS for the last drop folder and performing a compare after running an incremental build. Then copying just the changed files and a log of deleted files.
PS: The TFSBuild.proj type builds are very deprecated. They have been surpassed by the XAML builds in TFS 2010 and have been considered "legacy" since then. They have subsequently been surpassed by the new VSTS/Azure DevOps build system which has deprecated the XAML builds. Most of the properties that interact with Source Control are ignored when a TFSBuild.proj project is executed in the Legacy XAML workflow. Instead, the XAML agent takes care of fetching the sources prior to passing control to MsBuild. These new VSTS/Azure Devops build tasks are now also getting YAML support for Git based source control repositories.

Incremental Builds issue in Team Foundation Server

When we do a TFS Build, can we alter the build output so that the output is limited to only the changes so that deployment payload is reduced ? Example:
When I build a solution, I should only get the changed dlls not all (which includes Microsoft and other 3rd party dlls which are never changed.
Configure CI solution in TFS 2015, and unchecked clean options, Since TFS 2015/2017 always delivered all files - changed and unchanged, but I need only changed. This trick doesn't solve the issue:
Build (TFS Build), only what is changed
Followed a couple of other sources.
IncrementalBuild property in TFSBuild project
Incremental builds in TFS
Applied these tricks to update project with few settings (IncrementalBuild =True, ForceGet=False, SkipInitilizeWorksplace=True, SkipClean=True) under PropertyGroup definition to the end of the TFSBuild.proj file.
But the issue still persists, we are unable to produce only changed binaries in build folder, there is always all files.
Please help me to achieve the desired build output.
Incremental builds only rebuild assemblies that don't depend on changed files. But it does copy all of the project output (subsequent projects that depend on it may depend on these assemblies and files being there).
This causes incremental builds to be much faster, but it doesn't "only deliver the changed files". It always delivers all files whether they are changed or unchanged. On top of this, you could have multiple agents and each agent can have multiple working folders, the incremental build could use any of these as base for the incremental builds, there is no guarantee that the changed files are between your previous build and the current one.
You'll have to implement this feature yourself, it has never been part of MsBuild or TFS Build. It would involve querying TFS for the last drop folder and performing a compare after running an incremental build. Then copying just the changed files and a log of deleted files.
PS: The TFSBuild.proj type builds are very deprecated. They have been surpassed by the XAML builds in TFS 2010 and have been considered "legacy" since then. They have subsequently been surpassed by the new VSTS/Azure DevOps build system which has deprecated the XAML builds. Most of the properties that interact with Source Control are ignored when a TFSBuild.proj project is executed in the Legacy XAML workflow. Instead, the XAML agent takes care of fetching the sources prior to passing control to MsBuild. These new VSTS/Azure Devops build tasks are now also getting YAML support for Git based source control repositories.

Commit file back to repository from build server in Visual Studio Team Services

I'm currently setting up continuous integration using TFS/Visual Studio Team Services (was VS Online), and I'm using the Team Foundation Build 2015 tasks. So not the XAML builds.
I'm using it to build a Xamarin Android project, but that's pretty irreverent I guess,
The process should be like this:
After a check-in:
TFS should download the sources
TFS should increment the version number within AndroidManifest.xml
I've managed to do this by making a PowerShell script for this.
After the AndroidManifest.xml file is modified, it should be committed back into the TFS repository
Then the rest, build deploy into hockeyapp etc
The first steps are all configured, but I'm struggling with the commit part. How do I get TFS to commit the file? I don't really see any task suitable for it. I've tried using the Copy and Publish Build Artifacts Utility - But that did not seem to work, and I'm not even sure if that's the right utility
I'm using the default hosted build agent btw. Any help would be appreciated
Warning
I do want to point out that checking in changes as part of the build can lead to some features of VSTS/TFS not working. Association of work items to the checkin, sources and symbol generation, tractability from changes to build to release and integration with Test Manager, remote debugging, will likely not yield the expected results because the Changeset/commit recorded in te build may not match the actual sources. This may lead to unexpected funny behavior.
Also, if any new changes have already been committed/checked-in after the build has started, the version number may be updated in Source Control for code that was not actually released under that version.
So: First of all, it's considered a bad practice to change the sources from the build process.
Alternatives
There are better ways of doing it, one is to use the build version (Build_BuildNumber or Build_BuildID variables). Alternatively you an use a task like GitVersion to generate the semantic version based on the branch and tag in your git repository. That way your build will generate the correct version number and will increment the revision in case the same sources are built multiple times.
I understand, but I still want to check in my code as part of the build
If these things don't work for you and you still want to check in the changes as part of the build, you can either use the TFVC Build Tasks if you're using TFVC or use the Git Build Tools to add the remote to the local repository and then use the git commandline tools to commit and push the changes back to the repository.
These extensions require TFS Update 2 to install. But you can push the individual build tasks using the tfx commandlien tool. For the TFVC tasks the process is explained here.
On mac
On the mac it's going to be harder since you're using TFVC. My TFVC tasks leverage the TFS Client Object Model and Powershell to communicate to the TFS Server. The tf.exe tool doesn't even work on windows when you're in the context of a build, which is why I need to call into the VersionControlServer object directly. Given I'm dependent on these technologies, the tasks won't run on a Mac or Linux agent.
You could try to see whether the Team explorer Everywhere X-platform commandline works from the build agent (using a shell script). I have no way to test this on an actual Mac.
Given the cross platform nature of your project I'd recommend to move to Git, it integrates into XCode and Android Studio, making it easier to do a native UI or build on top of native libraries.
Alternative 2
You could setup a build which does the required changes to the code and then checks in the modified code. Then have a (CI) build run the Android and the Mac builds using the modified code.

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].

How do I increment the build/version number automatically on TFS Team builds?

I just downloaded the Automatic Versions add-in for VS here (https://visualstudiogallery.msdn.microsoft.com/dd8c5682-58a4-4c13-a0b4-9eadaba919fe/view/Discussions) and it works great locally, but how do I get it to work with Team Builds? Is there something I should install on the build server?
Firstly, the Automatic Version addin is not called in TFS build even if it is installed on TFS build server machine. In other words, you can't use it to generate incremental assembly version during TFS build process.
Instead, you need to create one custom build process activity to update assembly version, then customize the TFS build process template to add the activity. Please check the following links for the details of the sample build activity and how to customize build process template to use it.
http://www.codeproject.com/Articles/705482/Updating-Assembly-Versions-During-TFS-Builds
http://tfssimpleversioning.codeplex.com/
http://blogs.msdn.com/b/jjameson/archive/2010/11/29/incrementing-the-assembly-version-for-each-build-in-tfs-2010.aspx

Resources