Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude developer dependencies is not reflecting real runtime dependencies #847

Open
gotztibor opened this issue Feb 6, 2024 · 2 comments
Labels
stale triage Don't know what to do with this yet

Comments

@gotztibor
Copy link

The NuGet package assets are not considered correctly when developer dependencies are excluded.

The following assets are considered to have "runtime" dependency:

  • LibraryIncludeFlags.Runtime,
  • LibraryIncludeFlags.Native,
  • LibraryIncludeFlags.ContentFiles

Upon generating the dependencies without the developer dependencies (only availabe at build, but not at runtime) the dependencies are not calculated correctly.

Example project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <OutputType>exe</OutputType>
  </PropertyGroup>

  <ItemGroup>
    <!-- runtime true -->
    <PackageReference Include="Google.Protobuf" Version="3.25.2" PrivateAssets="analyzers;build" />
    <!-- runtime true with transitive dependencies -->
    <PackageReference Include="log4net" Version="2.0.15" ExcludeAssets="none" />
    <!-- runtime false, without transitive dependencies -->
    <PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" ExcludeAssets="all" />
    <!-- runtime true -->
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" IncludeAssets="runtime" ExcludeAssets="native;contentFiles;build" />
    <!-- runtime true -->
    <PackageReference Include="Serilog" Version="3.1.1" PrivateAssets="all" IncludeAssets="runtime" />
  </ItemGroup>

</Project>

Expected outcome:
As the Microsoft.Extensions.Logging is excluded fully, this will be just a developer dependency, and also it's transitive dependencies must not be shown as well. Also the build output folder and the default publish folder and the possibly generated NuGets package are not containing those NuGets and not referencing them.

@gotztibor
Copy link
Author

Please see Pull Request 848

Copy link

This issue is stale because it has been open for 3 months with no activity.

@github-actions github-actions bot added the stale label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale triage Don't know what to do with this yet
Projects
None yet
Development

No branches or pull requests

1 participant