Open sandboxFocusImprove this doc

LAMA0061: The referenced assembly was compiled with an incompatible version of Metalama

Severity Error
Reported by Metalama.Framework
Message The referenced assembly '<AssemblyIdentity>' has been compiled with Metalama <Version>, which stores compile-time code in a format that is incompatible with the current version of Metalama. Use the same version of Metalama to compile '<AssemblyIdentity>' and the current project.

Cause

When a project contains compile-time code, such as aspects or fabrics, Metalama embeds this code in the compiled assembly, together with a manifest. The manifest records the version of Metalama that compiled the assembly and the version of the storage format.

When another project references this assembly, Metalama reads the manifest. It reports LAMA0061 when the format version of the manifest is different from the one that the current version of Metalama uses. Metalama then ignores the compile-time code of the reference, so the aspects, fabrics, and other compile-time types it contains aren't available.

All versions of Metalama released so far use the same format, so in practice you'd see this error only when the referenced assembly was compiled with a more recent version of Metalama than the current project. In the message, <AssemblyIdentity> is the identity of the referenced assembly and <Version> is the version of Metalama that compiled it.

This diagnostic depends on the versions of Metalama used to compile several assemblies, so it can't be shown in an example.

Resolution

Use compatible versions of Metalama in the referenced assembly and in the current project:

  • If the referenced assembly comes from a NuGet package, update the Metalama.Framework package of the current project, and any other Metalama.* package, to the version given in the message or a later one. Alternatively, use an older version of the package that was compiled with your version of Metalama.
  • If the referenced assembly is another project of your solution, align the version of the Metalama packages across all projects, for instance with central package management, and rebuild the solution.

See also