Option to link variable group missing - tfs

According to the Microsoft docs, I should see an option to link to a variable group under the Variables tab in my build definition, but I don't see it.
I have a variable group defined, but Link Variable Group option does not show up. I'm using Microsoft Visual Studio Team Foundation Server Version 15.112.26301.0.

Your screenshot is referencing "Build" variables, however the documentation you reference is "Release" variables. These are two completely different setups in VSTS.
However, the ability to link variable groups in is worked into both Builds and Releases now from within VSTS. The screenshot below is from one of my build definitions while I am editing it.

You will have to use the new build definition editor to link variable groups.

Related

Is there a way to link variable group in TFS 2017 Build definition?

I know i can link my variable group stored in Library into a Release Definition, but my build definition doesn't have an option to link the variable group. I see it is available in TFS 2018. We are not upgrading our Prod instance from TFS 2017 anytime sooner. Is there any out of box method/way that i can link and read the library group?
Is there any out of box method/way that i can link and read the library group?
Sorry for any inconvenience.
I am afraid there is no such out-of-the-box method to link variable group in TFS 2017 Build definition.
There were many user voices about it before, and this request is resolved at Team Foundation Server 2018, MS team has no plans to apply it to TFS2017:
Variable group support
Variable groups have been available to use in release definitions, and now they are ready to be used in build
definitions, too. Learn more about creating a variable group. This has
been developed and prioritized based on related suggestions for
project-level build/release variables and variable groups in build
definitions.
And, AFAIK, there is currently no better workaround to solve this issue for TFS 2017.
So, we have to repeatedly define variables for each build pipeline before updating our TFS to 2018.
Hope this helps.
I was able to get TFS 2017 variable groups in JSON format. I'm now loading the JSON and instantiate the library groups.
http://tfsinstance/collectionname/teamproject/_apis/distributedtask/variablegroups/
Idea is to encapsulate this as a custom task and fetch required variable groups in the build definitions.
Variable group,in tfs 2017, are available only in release :(

What is the VSTS Link Settings feature?

I am talking about this:
The documentation I found is here - https://learn.microsoft.com/en-us/azure/devops/pipelines/process/parameters?view=vsts, but I must be plain stupid, because I do not understand one bit of it.
I do not know why it is so hard, but I cannot find anything meaningful on the web.
We have an on-premises TFS.
Let's say you have a build configuration ("Release") that you want to use in conjunction with multiple instances of the Visual Studio Build task.
You could add a variable called BuildConfiguration and then put the value $(BuildConfiguration) in the "Configuration" box for all of your Visual Studio Build tasks.
Or, you could enter the actual value, "Release", and then link the Configuration field in Visual Studio build to a pipeline parameter. Then you can manage the value from the "Pipeline" view.

Use enumerations (dropdowns) in variables of vNext build definitions (TFS)

Is it possible to use dropdown menus for variables in vNext build definitions? And how can this be done?(TFS 2017)
Theses variables shall also be available at queue time. By default, all variables are of type string and cannot be changed (screenshot).
The usage is for example to select the build environment (win7/win10...)
This was possible with the old build system (XAML)(screenshot)
Unfortunately, there is no such setting in TFS to have a dropdown in variables of vNext build definitions, you can only change the value manually (For example, type true instead of false for system.debug variable).
I've submitted a user voice for your requirement at website below, you can vote it there:
https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/32979130-use-dropdowns-in-variables-of-vnext-build-definiti

Is possible to pass a variable from a Build to a Release in TFS 2017?

A Build definition has a custom variable that can be set when a build is queued.
Is possible to have access to that variable from a Release in the same way that is possible to have access to variables like Build.DefinitionId, Build.DefinitionName, Build.BuildNumber ?
I've managed to do this with an extension from the TFS marketplace, called 'Variable (de|re)Hydration Tasks', from naked Agility Ltd. This extension provides build- and release tasks with which you basically can save your build variables and restore them in your release.
It does this by prefixes, so you can save/restore all default build variables that are prefixed with 'BUILD-', but if you prefix your own variables with i.e. 'ABC_' you can also save them from your build and restore them in your release.
A custom build variable couldn't be used in your release definition. Here is an user voice that similar to your problem: https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/14515326-project-level-build-release-variables. You could vote and add comment below.
As a workaround, you could copy those build variables and their values to a Variable groups. Then add the Variable group to your release definition.
This is a new feature in TFS 2017 Update1.
Have you tried just passing the variable into the task definition like $(MyVariable) (where MyVariable is the custom variable name)?

getting TFS build definition metadata programmatically

I would like to get and then edit, programmatically, all of the process paramater metadata from a TFS build definition. Does anyone know how to do that? Thank you.
It depends on what you are after, many of the standard build properties can be set using the TFS Team Project Manager application, available on CodePlex.
Updated based on comments below.
You need to use the TFS API. There's a good intro here. If you need to set custom attributes, you can modify the ProcessParameters (and MSDN)
The ProcessParameters only has entries when the parameter is different to the Default. Try editing an existing build definition and changing a setting to a non-default value. The BuildSettings has the path to the Solution to be built and the configuration to use. This is probably where you want to edit the path to match your branch. Also you need to change the Workspace.Mappings property on the new build definition.

Resources