I have a class library that I want to publish as a nuget package. It contains some attributes necessary at compile time (for an analyzer to function correctly), but it doesn't need to be included transitively, i.e. <PrivateAssets>all</PrivateAssets>
should be enabled on the package reference. I know that this can be achieved with <DevelopmentDependency>true</DevelopmentDependency>
, however, that also sets <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
, which isn't what I need. I need the default value for this to be <IncludeAssets>compile; runtime</IncludeAssets>
.
How can I modify my package to have the correct default value?
Current state of the package definition:
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><GeneratePackageOnBuild>true</GeneratePackageOnBuild><DevelopmentDependency>true</DevelopmentDependency><!--some more values like package id, version, etc.--></PropertyGroup></Project>
On install, this becomes
<PackageReference Include="My.Package.Name" Version="1.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>
I would like it to be
<PackageReference Include="My.Package.Name" Version="1.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>compile; runtime</IncludeAssets></PackageReference>