Open sandboxFocusImprove this doc

Distributing projects that use aspects

When your project uses aspects, consider whether the projects that reference your project will also need to use aspects due to this reference.

Flowing the use of aspects

Your project may flow the need to use aspects and the aspect framework to consumers of your project due to one of the following reasons:

  • Your project exposes public aspects that other projects can use.
  • Your project has non-sealed, public classes with inheritable aspects.
  • Your project has public classes that have reference validators.
  • Your project contains a transitive project fabric or references a project that includes one.

If this is the case, you don't need to take any action. Your package reference to Metalama.Framework will flow to consumers of your project.

Preventing the transitive use of aspects

If consumers of your project will not need to use aspects due to your project, you can prevent Metalama.Framework from flowing to its consumers by setting the PrivateAssets="all" property of the PackageReference.

You also need to include the Metalama.Framework.Redist package, which is the only package that needs to flow to consumers.

Add the following code snippet to your .csproj file:

<ItemGroup>
  <PackageReference Include="Metalama.Framework" PrivateAssets="all"/>
  <PackageReference Include="Metalama.Framework.Redist" />
</ItemGroup>