Private assets (such as analyzers) are package references that have an effect on compiling a .NET assembly, but are not needed by the compiled artifact. By marking them in the project file as private asset it will not become a runtime dependency, that is linked to a package, or shipped when publishing it.
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="DotNetProjectFile.Analyzers" Version="*" />
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="DotNetProjectFile.Analyzers" Version="*" PrivateAssets="all" />
</Project>
or
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="DotNetProjectFile.Analyzers" Version="*">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</Project>