Skip to content

Commit 3094203

Browse files
authored
Limit the version range for the VS generator to versions that CMake currently understands. (#7342)
1 parent 08e48f6 commit 3094203

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Microsoft.DotNet.CMake.Sdk/build/Microsoft.DotNet.CMake.Sdk.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
<PropertyGroup>
3131
<_CMakeMultiConfigurationGenerator>true</_CMakeMultiConfigurationGenerator>
3232
<_CMakePassArchitectureToGenerator>true</_CMakePassArchitectureToGenerator>
33+
<!-- We limit the VS version range for the generator since CMake only knows about specific VS versions -->
34+
<VSGeneratorVersionRange Condition="'$(VSGeneratorVersionRange)' == ''">[,17.0)</VSGeneratorVersionRange>
3335
<!-- Visual Studio uses the Win32 name for the x86 target architecture. -->
3436
<Platform Condition="'$(Platform)' == 'x86'">Win32</Platform>
3537
</PropertyGroup>
3638

3739
<Error Condition="'$(_VSNativeCompilerComponentArchName)' == ''" Text="Unable to determine if Visual Studio has MSVC tools installed for the '$(Platform)' architecture." />
3840

3941
<Exec
40-
Command="$(VSWherePath) -latest -prerelease -products * -requires $(_VSNativeCompilerComponentName) -property installationVersion"
42+
Command="$(VSWherePath) -latest -prerelease -products * -version $(VSGeneratorVersionRange) -requires $(_VSNativeCompilerComponentName) -property installationVersion"
4143
EchoOff="true"
4244
ConsoleToMsBuild="true"
4345
StandardOutputImportance="Low">

0 commit comments

Comments
 (0)