Repository navigation
fix: add C# references outside conditional ItemGroups - #770
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
lean library add appended the reference to the last ItemGroup. A Condition on that group made the library available only in that configuration. Project and package references now use a project ItemGroup with no Condition, or a new one when every group is conditional.
Contributor
Author
|
This PR now includes the regression from #769 for a project with no ItemGroup, along with coverage for default and prefixed MSBuild namespaces. Could you review both callers of the shared ItemGroup helper together, especially how the project-reference and NuGet-package paths handle existing references? The library manager and library command suites passed all 76 tests. This comment was drafted with Claude Code. |
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.
Fixes #767
Fixes #764
Adding the first C# library reference can fail when a project file has no ItemGroup because the fallback searches for a nested Project even though the parsed element is already the Project root. Appending to the last descendant ItemGroup can also put references inside a conditional group or a Target.
Both project and NuGet package references now use the last unconditional ItemGroup directly under the Project root, creating one if needed. The lookup and insertion use the Project namespace, so repeated adds reuse the existing reference in MSBuild files that use either a default namespace or a prefix.
The library manager and library command suites passed all 76 tests. Regression coverage includes the missing ItemGroup case from #769 and both namespace forms, with repeated project adds and package version updates.
This change was prepared with AI assistance.