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

Closed
maximpashuk opened this Issue Dec 27, 2013 · 4 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment Hide comment
@bladeoflight16

bladeoflight16 Jan 21, 2014

Contributor

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

Contributor

bladeoflight16 commented Jan 21, 2014

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

This comment has been minimized.

Show comment Hide comment
@maximpashuk

maximpashuk Jan 22, 2014

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

@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

This comment has been minimized.

Show comment Hide comment
@maximpashuk

maximpashuk Jan 22, 2014

I updated issue for real cause of error.

I updated issue for real cause of error.

@damianh

This comment has been minimized.

Show comment Hide comment
@damianh

damianh Mar 31, 2014

Contributor

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

Contributor

damianh commented Mar 31, 2014

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

@damianh damianh closed this in 9ea862f Nov 16, 2014

damianh added a commit that referenced this issue Nov 16, 2014

Merge pull request #121 from InPermutation/master
Fixes #92: remove unset variable reference/typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment