Open sandboxFocusImprove this doc

LAMA0113: An aspect type of a referenced assembly can't be found

Severity Error
Reported by Metalama.Framework
Message The aspect or template provider type '<AspectName>' defined in the assembly '<AssemblyName>' cannot be found in the current compilation.

Cause

When an assembly contains aspects, Metalama embeds its compile-time code and the list of its aspect and template provider types into the assembly. When a project references this assembly, Metalama reads the list and looks up each type by its full name in the compilation of the referencing project.

Metalama reports LAMA0113 when this lookup fails: no type with the name given by the first placeholder can be found in the assembly given by the second placeholder. This typically happens when several referenced assemblies define a type with the same full name, so that the name is ambiguous, and none of them is the assembly that declared the aspect, for instance when two different builds or versions of the same aspect library are referenced. It can also happen transiently in the IDE while project references are being updated.

This diagnostic depends on the references and the build state of the projects, so it can't be shown in an example.

Resolution

  • Make sure that the project references a single version of the assembly named in the message, directly and through its dependencies. Check the package versions and the project references, and look for copies of the assembly referenced as plain files.
  • Make sure that no other referenced assembly defines a type with the same full name.
  • Rebuild the solution so that all projects use the latest build of the aspect library. In the IDE, if the error persists after a successful build, restart the IDE.

See also