What is the process for upgrading the default tasks loaded by Microsoft in an on-premises TFS with no internet connectivity?
According to https://learn.microsoft.com/en-us/vsts/build-release/tasks/ there are several tasks now available and supported in TFS v2015-2018/VSTS that do not appear in my TFS 2017u2 installation (specifically the Download Secure File task).
The default tasks are not shown in the Manage Extension screens and the git repo (https://github.com/Microsoft/vsts-tasks) does not appear to have any instructions for how to package and install the latest versions in an existing TFS.
Download Secure File this task is not support by TFS2017 update2 for now.
In the right of the task, there is a column called Versions which stands for the supported TFS version and VSTS for now.
I use TFS on-premises and I don't see some of these features. Why not?
Some of these features are available only on VSTS and not yet
available on-premises. Some features are available on-premises if
you have upgraded to the latest version of TFS.
Source Link
The task you need is only available/build-in with VSTS by now.
However, this task is open sourced, you could find it here. You could also build it and package it as normal extension. Take a look at below steps for your reference:
Globally install typescript and tfx-cli (to package VSTS
extensions): npm install -g typescript tfx-cli
From the suitable of the repo run npm install. This will pull down
the necessary modules for the tasks and for the build tools.
Run npm run build to compile the build tasks or build a specific
task (recommended): node make.js build --task ShellScript
Run npm run package -- --version <version> to create the .vsix
extension packages (supports multiple environments) that includes
the build tasks.
With the .vsix files, you are easy to directly upload the extension. Details about this area, you could refer here:
How do you install extension vsix files to TFS 2015 (Update 3)?
How do I use the tfs-cli (tfx) to update a TFS extension for an on-premise TFS instance?
Besides, even you have published the extension to your TFS successfully, this task may not compatible with your present version, just Giulio said, you could create a test first. Certainly, you could also create your own extension as your demands.
Look at the Contribute page: it is a bit cryptic if you are not familiar with Javascript tooling.
CAVEAT: there is no guarantee that an update Task works with your TFS version and rolling back a change is a non-trivial task. Use, at least, a separate Collection to test changes.
Related
We are hosting TFS 2017 Update 2 on-prem, and using on-prem build agents. The latest version of NuGet.exe is currently 4.3.0, but our build agents always default to using v4.0.0. How can I get our build agents to use the latest version of NuGet.exe?
We need to update because NuGet restore is failing when using v4.0.0, but works with v4.3.0, since we are dealing with new .Net Standard 2.0 packages. On our build server I was able to do NuGet.exe update -self to update the NuGet.exe found at C:\Builds\_work\_tool\NuGet\4.0.0\x64\nuget.exe from 4.0.0 to 4.3.0, but that C:\Builds\_work\_tool directory regularly gets deleted and recreated, so this isn't a persistent workaround.
How can I get our build agents to always use the latest version of NuGet.exe, or at least v4.3.0?
I know you're not supposed to answer with a link, but this post provides all the details you'll need, confirming that the task does indeed still use 4.0.0, how with VSTS and TFS 2018 you don't have to worry about this anymore (there's a new NuGet Installer task) and how to recreate that kind of task for VS 2017.2 (and earlier) via a PowerShell Script, Using the latest NuGet in your build
Based on Greg's linked answer, but a little bit simpler:
Add a step "NuGet Tool Installer" before the other NuGet steps, use ">=5.0.0" for the version and mark "Always download the latest matching version", this should - well - give you the latest stable version
Replace the existing "NuGet Installer" steps - this seems to be the default with "NuGet Restore" steps, just copying the settings. They seem to be totally compatible, allowing e. g. for package config or solution files to be referenced, including pattern matching
That is it. Replacing the "NuGet Installer" that requires you to specify a version with the "NuGet Restore" that just uses the NuGet.exe from the path as set in "NuGet Tool Installer" is easier. Also mind the confusing naming (NuGet Tool Installer/NuGet Installer - the two are rather different).
Having to tinker so much with the not so old TFS 2017 infrastructure is a shame.
I used NuGet to add CastleWindsor to a project. Eveything works ok.
When I check it into tfs, I get the following message.
Unable to find version '3.3.3' of package 'Castle.Core'.
Any idea how I can get the build server to get the new version of Castle.Core?
First just as Dave commented, please check if you have add the nuget install task in your build definition and before your build task.
Also make sure you are using the right version of Nuget. For example, if you already use V3.0 and the config file are still point to V2.0. You will get this error.
Moreover, double check if the packages can be restored successfully on you dev PC and build agent manually, you can also compare the nuget.config file on your TFS server and dev PCs to see if there is any difference between them. The nuget.config file locates at "%APPDATA%\NuGet\NuGet.Config".
TFS2012 does not restore the nuget packages automatically, you need to add a build step to call the nuget command to restore the nuget packages. Refer to this link for details: Package Restore with Team Foundation Build.
With TFS 2013 and later, packages are automatically restored by
default during build, provided that you're using a Team Build Template
for Team Foundation Server 2013 or later.
If you're using a previous version of build templates (such as in a
project that's been migrated from earlier versions of TFS), you'll
need to also migrate those build templates to TFS 2013. This
essentially means recreating the custom parts of the Build Templates
using the appropriate template for your source control (TFVC or Git).
For earlier version of TFS, you can simply include a build step to
invoke command-line restore as described earlier.
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.
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
I want to create MSI build package as part of a TFS build.
What options there are?
i know about:
install VS on TFS server (http://geekswithblogs.net/jakob/archive/2010/05/14/building-visual-studio-setup-projects-with-tfs-2010-team-build.aspx)
Use 3rd party software on tfs
I do not wish to rely on 3rd party software or install vs 2010 on server as i have no licence to spare
Wix: http://wix.sourceforge.net/
It can be invoked using MsBuild.
I am using it quite successfully in one of my projects
This page gives some info on what is needed http://wix.sourceforge.net/manual-wix3/authoring_first_msbuild_project.htm
You should create the MSI Build package on TFS Build the same way you do it locally.
If you don't have anything yet, I strongly encourage you to look at Wix and use it. However Wix is mainly lowlevel package generation for MSI.
If you have complex needs for installation wizard you may rely on InstallShield to get the job done.
By using InstallShield (IS) you have two options:
Create a deployment project that will be 100% compatible with Windows Installer (the technology that builds .msi), no more no less. By doing that you can build your IS project pretty easily with Team Build.
Create a deployment project with the IS flavor (with a installation bootstrap) and you'll have to deploy the needed runtimes of IS in order to successfully build.
However I strongly encourage you to not choose the way you'll create your deployment package based on the Continous Integration constraints, if you have to install 3rd parties on your build agent, so be it, it won't be the toughest thing to do. (especially if those are VM you can clone)