Repository navigation
Fix GetPackOutputItems when nuspec does not exist - #7565
Merged
Merged
Conversation
nkolev92
approved these changes
Jul 15, 2026
nkolev92
left a comment
Member
There was a problem hiding this comment.
I think it's a very unfortunate timing that GetPackOutputItems can be out of date with PackTask.
Like all the effort in the fix we made was to ensure those 2 are always equivalent.
I understand this is the practical fix, but not in love with this.
nkolev92
force-pushed
the
dev-zivkan-GetPackOutputItemsTask-nuspec-not-found
branch
from
July 15, 2026 17:34
708e625 to
f740eed
Compare
Member
|
@zivkan I rebased so that the tests pass. cc @NuGet/nuget-client We need an approval here for merge. This PR carries some urgency because it's blocking code flow. |
jebriede
approved these changes
Jul 15, 2026
Contributor
|
Should Roslyn be updated so that their |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Fixes: NuGet/Home#14711
follow up from #7531
Description
Code flow into the .NET VMR failed: dotnet/dotnet#7703
Copilot says it's because roslyn has build customization where their analyzer packages generate their own nuspec file: https://github.com/dotnet/roslyn/blob/f8235426959cd1ffb2b6cbeb6feb2d21238f61b8/eng/targets/GenerateAnalyzerNuspec.targets#L139-L140
They seemingly do this to avoid restore cyclic references: https://github.com/dotnet/roslyn/blob/f8235426959cd1ffb2b6cbeb6feb2d21238f61b8/src/RoslynAnalyzers/Microsoft.CodeAnalysis.BannedApiAnalyzers/Core/Microsoft.CodeAnalysis.BannedApiAnalyzers.csproj#L5-L9
Their
GenerateAnalyzerNuspecFiletarget usesBeforeTargets="GenerateNuspec", but MSBuild's execution order is DependsOn, then BeforeTargets, then the target itself, followed by AfterTargets. SinceGenerateNuspecusesDependsOnforGetPackOutputItems, it means that it runs before roslyn'sGenerateAnalyzerNuspecFiletarget. Therefore, the nuspec file doesn't exist at the time #7531 changes try to read the file.This means that in the situation where a generated nuspec uses a package name different to what the MSBuild property PackageId value, then
GetPackOutputItemsTaskwill generate filenames different to whatGenerateNuspec(that actually generates nupkgs) creates.PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.N/A