Reference specific line of a file in the Code hub


One of the features of GitHub I use quite often is the ability to right-click any line number to create a link to that specific file on the exact line. It can eb useful when submitting issues or when providing a link to a piece of sample code.

While not so easy to find in VsTeam, the feature is there. To link to a specific line in the code hub first navigate to the file you want to link to, then copy the current location from the browser and append &line={number}.

That's all!

Access all available build variables from your VSTS Build task


NOTE: This cmdlet works with the Powershell host that shipped with TFS 2015 RTM and which will be replaced with a new task runner. Whether this functionality will remain, is uncertain.

If you want to know which variables are available during your build, or if you want people to create variables with a specific prefix and want to do anything with that, then you need access to the list of all available variables.

Though it's easy to access a specific variable by name using the Get-Variable cmdlet, it's not so easy to access all variables. Plus, the Get-Variable command only works when you know the full name beforehand.

Using the below function you receive a dictionary with the name and current value of each variable. You can use it to build tasks that use convention over configuration and retrie a list of all variables that start with a prefix you expect:

$MyVariables = (Get-Variables $distributedTaskcontext).Keys | ?{ $_.StartsWith("MyPrefix.") }

Use te cmdlet below to fetch all variables and do with them what you like:

function Get-Variables{
        [switch] $safe = $false
        Write-Debug "Entering: Get-Variables"
        $type = [Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces.IServiceManager] 
        $variableService = $type.GetMethod("GetService").MakeGenericMethod([Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces.IVariableService]).Invoke($distributedTaskContext, @())
        $dictionary = New-Object "System.Collections.Generic.Dictionary[string,string]" ([System.StringComparer]::OrdinalIgnoreCase)
        if ($safe.IsPresent)
        Write-Debug "Leaving: Get-Variables"
        return $dictionary

I used this little snippet to create a new build task which can expand the value of nested variables. You can find it here:

Configure SSL for SonarQube on Windows


The documentation for SonarQube explains how to configure SSL when you're running on Linux and how to use the native Tomcat functionality for a simple test environment, yet they recommend not to use this functionality in any production like setting.

Instead SonarQube recommends the use of a Reverse Proxy to secure you sonar installation. With the help of IIS and the Url Rewrite module, that's a piece of cake to setup.

What you'll need:

After installing and enabling these features, I had to do an IIS Reset and re-open the IIS Manager for all features to start working.

Next we'll go through the steps to configure the reverse proxy.

Search This Blog


Most Reading