SmartAssembly.Attributes nuget dependency

After adding a reference to the SmartAssembly.Attributes nuget, my nuget now shows as having a dependency on SmartAssembly.Attributes.

It would be better if your nuget worked like the Nullable nuget where it only added files to the project and not a dependency, as it is not required at runtime.

Here is a link to how they do it...
https://github.com/manuelroemer/Nullable/blob/master/src/Nullable.nuspec

Answers

  • Add PrivateAssets="all" to the reference in your .csproj file:

    xmlCopy code<span><PackageReference Include="SmartAssembly.Attributes" Version="x.y.z" PrivateAssets="all" /></span>
    

    Or include the attribute source files directly if licensing allows.

  • A_FA_F Posts: 2 New member
    Yes, but...

    - PrivateAssets="all" means that you have to add the SmartAssembly Nuget ref to all .dlls (I have over 50), and not just the CommonToAll dll.

    - Include the attribute source files directly. This is the solution I've gone with, but unlike using the Nuget, there is no automatic version notification if stuff changes. Also, if multiple dlls include the source you get a clash unless you change the namespace.

Sign In or Register to comment.