| Severity | Error |
| Reported by | Metalama.Framework |
| Message | Metalama is not enabled in this project. |
Cause
When Metalama initializes the processing of a project, it first checks that Metalama is enabled in this project. It reports LAMA0057 and stops when one of the following conditions is true:
- The compilation doesn't reference the
Metalama.Frameworkassembly. - The compilation doesn't define the
METALAMApreprocessor symbol, which theMetalama.Frameworkpackage normally adds to theDefineConstantsproperty. - The
MetalamaEnabledMSBuild property is set toFalse, or theMetalamaCompileTimeProjectproperty is set toTrue.
During a normal build, Metalama skips the projects where MetalamaEnabled is False, and it reports a missing METALAMA symbol as LAMA0053. LAMA0057 therefore typically means that the Metalama.Framework package is installed, so the Metalama compiler runs, but the compilation doesn't reference the Metalama.Framework assembly. This happens, for instance, when the package reference excludes the compile assets with ExcludeAssets="compile".
This diagnostic depends on the package references and the MSBuild configuration of the project, so it can't be shown in an example.
Resolution
- Reference the
Metalama.Frameworkpackage with a plainPackageReference, withoutExcludeAssetsorIncludeAssetsattributes that exclude the compile assets. - Make sure that
MetalamaEnabledisn't set toFalsein the project or in aDirectory.Build.propsorDirectory.Build.targetsfile, unless you don't want Metalama to process the project. - Make sure that the
DefineConstantsproperty isn't overwritten, so that it contains theMETALAMAsymbol.