Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3116

Create nuget package with specific default value for IncludeAssets

$
0
0

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>

Viewing all articles
Browse latest Browse all 3116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>