Open sandboxFocusImprove this doc

LAMA0222: The compile-time project can't be compiled

Severity Error
Reported by Metalama.Framework
Message The compile-time project could not be compiled. In most cases, this is due to a problem in your code and can be diagnosed using the other reported errors. If, however, you believe this is due to a bug in Metalama, please report the issue and include diagnostic information available in '<Directory>'.

Cause

Before it applies aspects, Metalama extracts the compile-time code of your project, such as aspects, fabrics, and classes marked with [CompileTime], transforms it, and compiles it into a separate compile-time assembly. Metalama reports LAMA0222 when this compilation fails.

Metalama reports the errors of this compilation together with LAMA0222. Most of the time, these errors point to a problem in your compile-time code. Less often, the failure comes from a bug in the code that Metalama generates for the compile-time assembly.

The <Directory> placeholder is a troubleshooting directory. Metalama writes the source files of the transformed compile-time project to it, as well as an errors.txt file that lists the compilation errors and the referenced assemblies.

The message contains the path of a randomly named directory, so this diagnostic can't be shown in an example.

Resolution

  1. Fix the other errors reported with LAMA0222. They usually indicate the location of the problem in your compile-time code.
  2. If the other errors aren't clear, open the directory given in the message and read errors.txt. It shows the errors as they occur in the transformed compile-time code, which you can find in the same directory.
  3. If you believe the problem comes from Metalama, report the issue and attach the content of this directory. Copy the directory first, because Metalama deletes it the next time it cleans up its temporary files.

See also