Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Set-StrictMode -Version Latest error in psake #92

maximpashuk opened this Issue · 4 comments

3 participants


If I set

Set-StrictMode -Version Latest

before running psake, then i get an error

"The variable '$buildToolsVersions' cannot be retrieved because it has not been set"

I suppose this is because of variable $buildToolsVersions declared inside of one block, and checked in another block.

Please adaptate psake to work with "Set-StrictMode -Version Latest" set before calling psake.


I have been using the line $ErrorActionPreference = 'Stop' in my scripts for a couple years now ever since I started using it. I place this call in my kick off scripts, which actually do the calling to psake (so it is before running psake or even loading the module). Is this something that broke with a newer version? Do your scripts leave off the $?


@bladeoflight16 , yes, you right.

$ErrorActionPreference = 'Stop'

is not a cause of error.

The real cause of error is

Set-StrictMode -Version Latest

If you set this option before executing psake, then error occur.
"The variable '$buildToolsVersions' cannot be retrieved because it has not been set"

Usually I set both of them, so I confused about real cause of error.


I updated issue for real cause of error.


@maximpashuk Can you post a repro script in a github repo so I can reproduce this. Thanks.

@damianh damianh closed this in 9ea862f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.