msbuild: Solution target generation does not take into account imported targets

A target added to a project via solution project extensibility points is no longer accessible after #1497, because the injected call-arbitrary-target-in-all-projects target overrides the one imported from After.SolutionName.sln.targets. This produces errors like

S:\msbuild>bin\Bootstrap\15.0\Bin\MSBuild.exe src\MSBuild.sln /t:PackNugetPackages /v:q
Microsoft (R) Build Engine version 15.1.523.56541
Copyright (C) Microsoft Corporation. All rights reserved.

S:\msbuild\src\Framework\Microsoft.Build.Framework.csproj : error MSB4057: The target "PackNugetPackages" does not exist in the project.
S:\msbuild\src\XMakeCommandLine\MSBuild.csproj : error MSB4057: The target "PackNugetPackages" does not exist in the project.

This regresses solutions that use a target at the solution level to restore NuGet packages, a common pattern for Xamarin.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Verified fixed, thanks!! 😄