Quantcast
Channel: Team Foundation Server - General forum
Viewing all articles
Browse latest Browse all 6687

TFS 2015 RC Build.Preview mode does not seem to set values in the TFS build environment variables

$
0
0

Hi,

According to this page documentation we scripted out in powershell some PreBuild and PostBuild actions wich were executed within our XAML build process. Moving from TFS 2013 Update 4 to TFS 2015 RC worked fine for our XAML build. The build and scripts continued to build perfectly.

Then we wanted to give a try at the Build.Preview feature. Building the same solution over the same dedicated build server worked good. Then i added to the build definition a powershell step to execute our PreBuild script before the MSBuild step.

It runs the script but fails when using the TFS Build environment variables. They just seem to be not initialized. Here's some powershell code where we begin the script by testing if the variables we're using are defined:

        

function Test-EnvironmentVariable
{
    [CmdletBinding()]
    Param
    (
        [Parameter()]
        [ValidateNotNullOrEmpty()]
        [string]$VariableName=$(throw "VariableName is mandatory.")
    )

    if (-not (Test-Path Env:\$VariableName))
    {
        Write-Error "Variable $VariableName is not defined"
        exit 1
    }
}

Test-EnvironmentVariable -VariableName "TF_BUILD"
Test-EnvironmentVariable -VariableName "TF_BUILD_BUILDNUMBER"
Test-EnvironmentVariable -VariableName "TF_BUILD_SOURCESDIRECTORY"
Test-EnvironmentVariable -VariableName "TF_BUILD_BINARIESDIRECTORY"
Test-EnvironmentVariable -VariableName "TF_BUILD_DROPLOCATION"

What's bothering me is that the error pops on the second test. This would mean that TF_BUILD variable is set but the TF_BUILD_BUILDNUMBER is not.

Is there a way i can run/test my powershell onto my build server in a way im "like the build agent". I mean that if i start a powershell session, none of the TFS environment variables are define, wich is pretty normal. Is there a way to start a powershell session just like the build agent does so i could find out what variables are really defined and what other are not?

Or is it normal that the new Build.Preview mode does not set those variables? A bug?


Viewing all articles
Browse latest Browse all 6687

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>