question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in `eng/common/tools.ps1`: The variable '$vsMajorVersion' cannot be retrieved because it has not been set

See original GitHub issue

A 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:closed
  • Created a year ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
davidwengiercommented, Nov 14, 2022

Thanks. I guess I read the “not too low” comment above to mean “not too low, but could be better” 😃

1reaction
mmitchecommented, Nov 14, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found