| Severity | Error |
| Reported by | Metalama.Framework |
| Message | The project references the following version(s) of Metalama.Framework: <SelectedVersions>. The project must reference a single version of Metalama.Framework, and this version must not be higher than '<SupportedVersion>', the version of the Metalama engine that compiles the project. |
Cause
The Metalama.Framework package contains both the Metalama.Framework assembly, which your project references, and the Metalama engine, which transforms your project during compilation. The engine can only process code written against its own version of Metalama.Framework or an older one.
Before it transforms the project, Metalama checks the references of the compilation to the Metalama.Framework assembly, and reports LAMA0054 in the following situations:
- The compilation references several versions of the
Metalama.Frameworkassembly. - The compilation references a version of
Metalama.Frameworkthat's higher than the version of the engine.
In the message, <SelectedVersions> lists the versions of Metalama.Framework referenced by the project, and <SupportedVersion> is the version of the engine. Metalama doesn't transform the project.
This situation shouldn't happen when the project references Metalama.Framework only with a PackageReference, because the assembly and the engine then come from the same package. It typically comes from a direct reference to a Metalama.Framework.dll file, for instance with a Reference item and a HintPath, whose version doesn't match the package.
This diagnostic depends on the references and package versions of the project, so it can't be shown in an example.
Resolution
- Check the versions given in the message.
- Remove any direct reference to a
Metalama.Framework.dllfile, and referenceMetalama.Frameworkonly through aPackageReference. - Align the version of all
Metalama.*packages across the projects of the solution, for instance with central package management. - Rebuild the project.