mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-22 16:07:49 +08:00
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.
This commit is contained in:

committed by
Brad King

parent
fa76e5d194
commit
a450cc9533
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user