summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bhardwaj <bhardwajs@outlook.com>2021-12-15 16:10:57 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-15 17:27:39 (GMT)
commita450cc9533ac8a54d14ec5e0cbf6b379a2014e7a (patch)
tree5d773d11a1a99f56971ff1d24fb9cff3371da7d5
parentfa76e5d194c2641ca8ee40c2053860196e8a445b (diff)
downloadCMake-a450cc9533ac8a54d14ec5e0cbf6b379a2014e7a.zip
CMake-a450cc9533ac8a54d14ec5e0cbf6b379a2014e7a.tar.gz
CMake-a450cc9533ac8a54d14ec5e0cbf6b379a2014e7a.tar.bz2
VS: Set ResolveNugetPackages to false for ALL_BUILD and ZERO_CHECK
When SDK-style targets in a project are restored, ResolveNugetPackageAssets target is not skipped. However, ALL_BUILD and ZERO_CHECK do not have any nuget packages to resolve and the build fails. This commit sets ResolveNugetPackages to false which skips the target and the build succeeds.
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 088369c..6f6b0a6 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -461,6 +461,20 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
e1.Element("PreferredToolArchitecture", hostArch);
}
+ // ALL_BUILD and ZERO_CHECK projects transitively include
+ // Microsoft.Common.CurrentVersion.targets which triggers Target
+ // ResolveNugetPackageAssets when SDK-style targets are in the project.
+ // However, these projects have no nuget packages to reference and the
+ // build fails.
+ // Setting ResolveNugetPackages to false skips this target and the build
+ // succeeds.
+ std::string_view targetName{ this->GeneratorTarget->Target->GetName() };
+ if (targetName == "ALL_BUILD" ||
+ targetName == CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
+ Elem e1(e0, "PropertyGroup");
+ e1.Element("ResolveNugetPackages", "false");
+ }
+
if (this->ProjectType != VsProjectType::csproj) {
this->WriteProjectConfigurations(e0);
}