Skip to content

NuGet: Microsoft.CodeAnalysis.* dependencies should likely be private assets #69

@magicxor

Description

@magicxor

Hi,

First off, thank you for creating and maintaining such a great and performant library!

I was looking at the NuGet package dependencies for MyCSharp.HttpUserAgentParser.AspNetCore and noticed it lists the following dependencies:

  • Microsoft.CodeAnalysis.CSharp >= 4.13.0
  • Microsoft.CodeAnalysis.CSharp.Workspaces >= 4.13.0
  • Microsoft.CodeAnalysis.Common >= 4.13.0

It seems to me that these particular dependencies might not need to be delivered as dependencies of the NuGet package because they appear to be related to compile-time tasks (perhaps for analyzers used within the library?) rather than runtime requirements for consuming applications.

Listing these as regular dependencies can lead to version conflicts in consuming projects. In my specific case, my project already depends on Microsoft.CodeAnalysis.* version 4.8.x (due to a dependency on Microsoft.VisualStudio.Web.CodeGeneration.Design). Because MyCSharp.HttpUserAgentParser.AspNetCore requires version >= 4.13.0, NuGet reported a version conflict and I was unable to install MyCSharp.HttpUserAgentParser.AspNetCore alongside my existing dependencies.

Image

Could you please consider marking these specific <PackageReference> items with PrivateAssets="all"?

This change would help ensure that users of MyCSharp.HttpUserAgentParser.AspNetCore only inherit the necessary runtime dependencies.

Thanks again for your work on this project!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions