-
Notifications
You must be signed in to change notification settings - Fork 266
Description
NuGet Product Used
NuGet SDK
Product Version
7.3.0-preview.1.10
Worked before?
nope
Impact
It's more difficult to complete my work
Repro Steps & Context
Global dependency groups in .nuspec files are incorrectly parsed as "unsupported" instead of "any"
Problem
Dependency groups in .nuspec files that don't specify a targetFramework attribute (global dependencies) are incorrectly parsed as UnsupportedFramework instead of AnyFramework. This causes them to display as "unsupported" in tools like NuGet Package Explorer, rather than "any".
Steps to Reproduce
-
Create a
.nuspecfile with global dependencies like this:<dependencies> <group> <dependency id="SomePackage" version="1.0.0" /> </group> <group targetFramework="netstandard2.0"> <dependency id="AnotherPackage" version="2.0.0" /> </group> </dependencies>
-
Pack the package and open it in NuGet Package Explorer
-
Observe that the first dependency group (without
targetFramework) shows as "unsupported" instead of "any"
Expected Behavior
The dependency group without targetFramework should be treated as targeting "any" framework, displaying as "any" in the UI.
Actual Behavior
The dependency group without targetFramework is parsed as UnsupportedFramework, displaying as "unsupported" in the UI.
Root Cause
ManifestReader.ReadDependencyGroups (used by Manifest.ReadFrom) defaults to UnsupportedFramework when the targetFramework attribute is missing from a dependency group.
Solution
Modified ManifestReader.ReadDependencyGroups to use AnyFramework when targetFramework is missing or empty.
Files Changed
src/NuGet.Core/NuGet.Packaging/PackageCreation/Authoring/ManifestReader.cs
Impact
This affects any package with global dependencies (dependencies that apply to all frameworks). Tools that display dependency information will show incorrect framework information.
Environment
- NuGet.Client version: dev branch
- .NET version: 8.0/10.0
- OS: Windows