Environment variables
| Property | Type | Description |
|---|---|---|
METALAMA_TEMP |
String | The root path of Metalama temporary directory. The default value is the result of Path.GetTempPath(). |
MSBuild properties
All environment variables are imported as MSBuild properties by default.
| Property | Type | Description |
|---|---|---|
MetalamaCompilerTransformerOrder |
Semicolon-separated list | Specifies the execution order of transformers in the current project. Transformers are identified by their namespace-qualified type name, excluding the assembly name. This property is generally unimportant because the only transformer is typically Metalama.Framework. |
MetalamaDebugTransformedCode |
Boolean | Indicates whether to debug the transformed code instead of the source code. The default value is False. |
MetalamaEmitCompilerTransformedFiles |
Boolean | Indicates whether Metalama.Compiler should write the transformed code files to disk. The default is True if MetalamaDebugTransformedCode is enabled, and False otherwise. |
MetalamaCompilerTransformedFilesOutputPath |
Path | Specifies the directory path where transformed code files are written. The default is obj/$(Configuration)/metalama. |
MetalamaDebugCompiler |
Boolean | Specifies whether to attach a debugger to the compiler process. The default value is False. |
MetalamaLicense |
String | Represents a Metalama license key or license server URL. Any license key or license server URL provided this way takes precedence over the license registered via the metalama global tool. |
MetalamaEnabled |
Boolean | When set to False, specifies that Metalama.Framework won't execute in this project, even though the Metalama.Framework package is referenced. It doesn't affect the Metalama.Compiler package. |
MetalamaFormatOutput |
Boolean | Indicates whether the transformed code should be nicely formatted. The default value is True if MetalamaDebugTransformedCode is True and False otherwise. Formatting the transformed code has a performance overhead and should only be performed when the code is being troubleshot or exported. |
MetalamaFormatCompileTimeCode |
Boolean | Indicates whether the compile-time code should be nicely formatted. The default value is False. Formatting the compile-time code has a performance overhead and should only be performed when the code is being troubleshot or exported. |
MetalamaCompileTimeProject |
Boolean | Indicates whether the complete project is compile-time code. This property is set to True by the Metalama.Framework.Sdk package. Otherwise, the default value is False. |
MetalamaDesignTimeEnabled |
Boolean | Indicates whether the real-time design-time experience is enabled. The default value is True, and it can be set to False to work around performance issues. When this property is set to False, refreshing the IntelliSense cache requires you to rebuild the project. |
MetalamaRemoveCompileTimeOnlyCode |
Boolean | Indicates whether Metalama should replace compile-time-only code with throw new NotSupportedException() in produced assemblies. The default value is True because Metalama normally executes compile-time-only code from the compile-time sub-project embedded as a managed resource in the assembly. This property should be set to False in public assemblies referenced by a weaver-style project (using Metalama SDK) because Metalama SDK needs to execute compile-time-only code from the main assembly. |
MetalamaCompileTimeTargetFrameworks |
Semicolon-separated list | Specifies the list of target frameworks for which compile-time projects should be built. The default value covers all native frameworks that are known to host the compiler. Override this property if you don't need all of them and cannot install the required .NET targeting packs on the machine. netstandard2.0 is required. |
MetalamaRestoreSources |
Semicolon-separated list | Specifies the list of NuGet feeds used when restoring the compile-time project. The default value is https://api.nuget.org/v3/index.json. |
MetalamaCreateLamaDebugConfiguration |
Boolean | Indicates whether the LamaDebug build configuration should be automatically defined (see below). The default value is True. |
MetalamaTemplateLanguageVersion |
String | Specifies the C# language version (e.g., 10.0) that's used by templates. Any syntax from higher C# versions isn't allowed in template bodies. Such templates can then be used in projects that use this C# version. |
MetalamaConcurrentBuildEnabled |
Boolean | Specifies whether Metalama can parallelize work across several cores. The default value is True. |
MetalamaRoslynIsCompileTimeOnly |
Boolean | Indicates whether types from the Microsoft.CodeAnalysis namespaces are considered compile-time-only. The default value is True. Set it to False if your project uses Roslyn in runtime code. |
MSBuild items
| Item | Description |
|---|---|
MetalamaTransformedCodeAnalyzer |
Represents a list of analyzers that must execute on the transformed code instead of the source code. Items can be set to a namespace or a full type name. |
MetalamaCompileTimePackage |
Represents a list of packages accessible from the compile-time code. These packages must explicitly target .NET Standard 2.0 and be included in the project as a ProjectReference. By default, only the .NET Standard 2.0 API and the Metalama API are available to compile-time code. |
MetalamaExtensionAssembly |
Loads an assembly as a Metalama extension at compile time. The assembly must contain types exported via ExportExtensionAttribute. Supports TargetFramework (e.g., net472, net8.0) and TargetRoslynVersion (e.g., 4.8, 4.12, 5.0) metadata to specify which build of the extension to load. See SDK extension projects. |
MetalamaCompileTimeAssembly |
Makes an assembly available to compile-time code. Use this when your compile-time code references types from an external assembly that isn't a NuGet package. See SDK extension projects. |
MSBuild build configurations
When you import Metalama.Framework, a new build configuration named LamaDebug is defined unless you set the MetalamaCreateLamaDebugConfiguration property to False.
The LamaDebug configuration assigns the following properties:
<PropertyGroup Condition="'$(Configuration)'=='LamaDebug'">
<MetalamaDebugTransformedCode>True</MetalamaDebugTransformedCode>
</PropertyGroup>