| Severity | Error |
| Reported by | Metalama.Framework |
| Message | Metalama could not build the internal project that resolves the compile-time reference assemblies, therefore the compilation cannot continue. The build of '<ProjectPath>' exited with code <ExitCode>. <ReportedErrors> <ProbableCause> The binary log of that build is '<BinaryLogPath>'. |
Cause
Before it compiles your aspects, Metalama must know exactly which APIs compile-time code can use. To find out, it generates a small project, TempProject.csproj, under the Metalama temporary directory, then restores and builds it in a separate process with dotnet build, or with MSBuild.exe when your project is built without a .NET SDK. The result is cached, so this build normally runs only once per combination of settings.
Metalama reports LAMA0082 when this build exits with an error. In the message:
<ProjectPath>is the path of the generated project and<ExitCode>is the exit code of the build.<ReportedErrors>quotes the errors that the build reported, or its last output lines when it reported no recognizable error.<ProbableCause>describes the probable cause when Metalama recognizes it in the output, for instance a missing package (NU1101), an unreachable feed (NU1301), a feed with an HTTP address (NU1302), an authentication error, a .NET SDK that's too old (NETSDK1045), or aglobal.jsonfile that requests a .NET SDK that isn't installed. Otherwise, it's a generic sentence.<BinaryLogPath>is the path of the MSBuild binary log of the failed build.
The failure is almost always caused by the environment rather than by a defect of Metalama. The most frequent causes are:
- A NuGet feed that requires credentials. The build runs in a separate process, which can't ask for credentials interactively.
- A
packageSourceMappingrule innuget.configthat routesMicrosoft.CodeAnalysis.*packages to a private feed that doesn't carry them. The generated project inherits yournuget.configfiles. - A
global.jsonfile that requests a .NET SDK version that isn't installed. - No network access to the configured feeds.
This diagnostic depends on the build environment of the machine, so it can't be shown in an example.
Resolution
- Read the quoted errors and the probable cause in the message. They usually point to the fix directly.
- If they aren't enough, open the binary log given in the message with the MSBuild Structured Log Viewer to see exactly what failed.
- Fix the environment, depending on the cause:
- Make the credentials of private feeds available without user interaction, for instance in a
nuget.configfile or through a credential provider. - In your
packageSourceMapping, mapMicrosoft.CodeAnalysis.*packages to a source that provides them, such as nuget.org. - Install the .NET SDK version requested by
global.json, or changeglobal.json. - If the generated project needs additional MSBuild configuration in your environment, use the
MetalamaAssemblyLocatorHooksDirectoryproperty.
- Make the credentials of private feeds available without user interaction, for instance in a
- Build again.