I’ve packaged and published my code generator, including code fixes and a DLL specifically for the attribute that triggers everything. The attribute isn’t available when I add the package to my .NET 8 project.
If I look at the package with NuGet Package Explorer I see this:
The attribute defined in the DLL is public. What am I missing to make it usable?
This is what I have in the project that does the packing:
<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddAnalyzersToOutput</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..RegisterWithDi.AttributeRegisterWithDi.Attribute.csproj" />
<ProjectReference Include="..RegisterWithDi.CodeFixesRegisterWithDi.CodeFixes.csproj" />
<ProjectReference Include="..RegisterWithDiRegisterWithDi.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..README.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
<Target Name="_AddAnalyzersToOutput">
<ItemGroup>
<TfmSpecificPackageFile Include="$(OutputPath)RegisterWithDi.dll" PackagePath="analyzers/dotnet/cs" />
<TfmSpecificPackageFile Include="$(OutputPath)RegisterWithDi.CodeFixes.dll" PackagePath="analyzers/dotnet/cs" />
<TfmSpecificPackageFile Include="$(OutputPath)RegisterWithDi.Attribute.dll" PackagePath="analyzers/dotnet/cs" />
<TfmSpecificPackageFile Include="$(OutputPath)RegisterWithDi.Attribute.dll" PackagePath="libnetstandard2.0" />
</ItemGroup>
</Target>