Repository navigation
Fix dotnet add package incorrectly adding PrivateAssets to PackageVersion item in CPM projects - #7258
Merged
Merged
Conversation
nkolev92
marked this pull request as draft
April 6, 2026 20:00
nkolev92
force-pushed
the
dev-nkolev92-fixDotnetAddPkgMistake
branch
2 times, most recently
from
April 6, 2026 20:57
48d035a to
5629074
Compare
nkolev92
commented
Apr 7, 2026
Copilot
AI
changed the title
Fix dotnet add package incorrectly adding PrivateAssets to PackageVersion item
Fix dotnet add package incorrectly adding PrivateAssets to PackageVersion item in CPM projects
Apr 7, 2026
nkolev92
marked this pull request as ready for review
April 8, 2026 17:28
zivkan
approved these changes
Apr 8, 2026
nkolev92
enabled auto-merge (squash)
April 9, 2026 17:49
…sion with dev dependencies Co-authored-by: Copilot <[email protected]>
nkolev92
force-pushed
the
dev-nkolev92-fixDotnetAddPkgMistake
branch
from
April 10, 2026 17:06
91b28b3 to
1cb9f6f
Compare
|
How do we track which release this will be available in? |
Member
Author
|
@Frulfump milestones are set whenever we know for sure what the ship vehicle of an issue is. This one will 7.9, which will be the equivalent to .NET 10.0.400. |
This was referenced Apr 15, 2026
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#14601
Description
When running dotnet add package for a development dependency (e.g., xunit.runner.visualstudio) in a CPM (Central Package Management) project, PrivateAssets and IncludeAssets metadata were incorrectly added to the item in Directory.Packages.props. These metadata should only appear on the item in the project file.
Root cause: AddPackageVersionIntoPropsItemGroup() called AddExtraMetadataToProjectItemElement(), which writes asset metadata (PrivateAssets, IncludeAssets) to the item. For items, only version metadata should be present.
Fix: Removed the AddExtraMetadataToProjectItemElement call from AddPackageVersionIntoPropsItemGroup. The CPM flow already correctly adds asset metadata to via AddPackageReferenceIntoItemGroupCPM.
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc