Explorar o código

VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022

MSBuild defaults to v4.0 but VS 2022 does not install it anymore.
Explicitly specify a newer framework version by default.  Use a
version that VS 2022 installs without selecting a separate component.

Fixes: #22835
Brad King %!s(int64=4) %!d(string=hai) anos
pai
achega
d51246c662
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      Source/cmGlobalVisualStudioVersionedGenerator.cxx

+ 6 - 0
Source/cmGlobalVisualStudioVersionedGenerator.cxx

@@ -401,6 +401,12 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
     this->DefaultPlatformName = VSHostPlatformName();
     this->DefaultPlatformName = VSHostPlatformName();
     this->DefaultPlatformToolsetHostArchitecture = VSHostArchitecture();
     this->DefaultPlatformToolsetHostArchitecture = VSHostArchitecture();
   }
   }
+  if (this->Version >= cmGlobalVisualStudioGenerator::VS17) {
+    // FIXME: Search for an existing framework?  Under '%ProgramFiles(x86)%',
+    // see 'Reference Assemblies\Microsoft\Framework\.NETFramework'.
+    // Use a version installed by VS 2022 without a separate component.
+    this->DefaultTargetFrameworkVersion = "v4.7.2";
+  }
 }
 }
 
 
 bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(
 bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(