Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Set-StrictMode -Version Latest error in psake 4.3.1.0 #92

Closed
maximpashuk opened this Issue · 4 comments

3 participants

@maximpashuk

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.

@bladeoflight16

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 $?

@maximpashuk

@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.

@maximpashuk

I updated issue for real cause of error.

@damianh
Owner

@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.