Skip to content

Commit

Permalink
Fix NU5128 dotnet pack warnings
Browse files Browse the repository at this point in the history
It detects that lib\* assemblies are listed for multiple target frameworks, but dependencies are not separated by framework & warns about this. The current guidance is to separate dependencies by target framework, even if the dependencies are identical.

Note that I haven't applied the same change to xRetry.Specflow, since it didn't warn for that. That seems to be because the different files are under build\*, not lib\* or ref\*...

From the docs (https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128):
If you are using a custom nuspec file, we recommend each TFM for which lib/ or ref/ assemblies exist should have a matching dependency group, even if the dependencies are the same as the next compatible TFM. For example, if a package contains netstandard1.0 and netstandard2.0 assemblies, and the dependencies are the same for both, we recommend both TFMs be listed as dependency groups with duplicate dependency items.

Note that the TFM identifier used in the assembly paths use a different format to the TFM identifier used in dependency groups. The warning message specifies the correct name to use in the dependency group. If your package does not have any dependencies for that target framework, use an empty group
  • Loading branch information
JoshKeegan committed Nov 8, 2024
1 parent dc6d365 commit d4ce3af
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/xRetry/xRetry.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
<readme>docs\README.md</readme>

<dependencies>
<dependency id="xunit.core" version="[2.4.0,3.0.0)" />
<group targetFramework=".NETStandard2.0">
<dependency id="xunit.core" version="[2.4.0,3.0.0)" />
</group>

<group targetFramework=".NETFramework4.5.2">
<dependency id="xunit.core" version="[2.4.0,3.0.0)" />
</group>
</dependencies>
</metadata>

Expand Down

0 comments on commit d4ce3af

Please sign in to comment.