| Severity | Error |
| Reported by | Metalama.Framework |
| Message | Two references provide the compile-time assembly '<AssemblyName>': '<FirstIdentity>' and '<SecondIdentity>'. Metalama cannot use two versions of the same compile-time assembly. Fix the references of the project so that a single version of '<AssemblyName>' is referenced. |
Cause
Metalama loads the compile-time code of the project and of its references into an isolated environment, which can hold only one assembly of a given name.
Most projects that contain compile-time code, such as aspects or fabrics, embed it in their assembly under a name that's unique to each build, so they never conflict. However, some assemblies are marked with [assembly: CompileTime] without embedding their compile-time code, typically the public assemblies of aspect libraries built with the Metalama SDK, such as weaver-based aspects or SDK services. Metalama loads such an assembly under its own name.
Metalama reports LAMA0079 when two references of the project are such assemblies with the same name but a different identity, for instance two versions of the same assembly. Metalama can't load both, and it can't choose one of them. In the message, <AssemblyName> is the name of the assembly, and <FirstIdentity> and <SecondIdentity> are the full identities of the two references.
The diagnostic isn't attached to any location in the source code. It depends on the references of the project, so it can't be shown in an example.
Resolution
- Use the two identities given in the message to find how each version reaches the project. In Visual Studio, look under the Dependencies node of the project. On the command line, inspect the
project.assets.jsonfile underobj, or a binary build log. - Change the references so that a single version of the assembly is referenced: remove the redundant reference, or align the versions of the packages or projects that bring the assembly.
- Rebuild the project.