Error in `eng/common/tools.ps1`: The variable '$vsMajorVersion' cannot be retrieved because it has not been set
See original GitHub issueA community member reported an error trying to build Razor in a docker container:
Using xcopy-msbuild version of 17.2.1 since VS version 16.3 provided in global.json is not compatible
The variable '$vsMajorVersion' cannot be retrieved because it has not been set.
More context in the issue: https://github.com/dotnet/razor-tooling/issues/7005
The issue seems to be in eng/common/tools.ps1
where there is a code path that indeed doesn’t set $vsMajorVersion
:
https://github.com/dotnet/arcade/blob/main/eng/common/tools.ps1#L414-L415
Should that path throw? Or set the variable to something? Or is there something we can do on the Razor side to prevent this happening?
Issue Analytics
- State:
- Created a year ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Mule PowerShell Connector - The variable '$ ...
The symptom - error The variable '<name>' cannot be retrieved because it has not been set. - indeed implies that a variable is...
Read more >Powershell: The variable '$_' cannot be retrieved because ...
The variable '$_' cannot be retrieved because it has not been set. This piece of code works as expected when I run it...
Read more >The variable '$ITEM' cannot be retrieved because it has not ...
The problem: The variable '$ITEM' cannot be retrieved because it has not been set.
Read more >Use PowerShell Strict Mode for Debugging - Scripting Blog
The variable '$c' cannot be retrieved because it has not been set. At C:\fso\SimpleTypingError.ps1:4 char:28 + 'The value of $c is: ' +...
Read more >Installing flyctl via PowerShell fails when Set-StrictMode ...
Simplified PowerShell script for repro: Set-StrictMode -Version ... The variable '$v' cannot be retrieved because it has not been set.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks. I guess I read the “not too low” comment above to mean “not too low, but could be better” 😃
Usually it’s only updated when VS requirements change. For instance, if you started targeting 7.0, it would make sense to require 17.4, since 7.0 cannot be targeted with 17.3 and earlier.