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
Note that all environment variables are imported as MSBuild properties by default.
| Property | Type | Description |
| 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 you want 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 the transformed code files are written. The default is obj/$(Configuration)/metalama
. |
| MetalamaDebugCompiler
| Boolean | Specifies that you want 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 should not execute in this project, although the Metalama.Framework package is referenced in the project. It does not affect the Metalama.Compiler package. |
| MetalamaFormatOutput
| Boolean | Indicates that 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 that 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 that 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 that 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 that 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 is netstandard2.0;net8.0;net48
. Override this property if you 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 that 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 is not allowed in template bodies. Such templates can then be used in projects that use this C# version.
| MetalamaConcurrentBuildEnabled
| Boolean | Specifies that Metalama can parallelize work across several cores. The default value is True
. |
| MetalamaRoslynIsCompileTimeOnly
| Boolean | Indicates that 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. |
MSBuild build configurations
When you import the Metalama.Framework
, a new build configuration named LamaDebug
is defined unless you explicitly set the MetalamaCreateLamaDebugConfiguration
property to False
.
The LamaDebug
configuration assigns the following properties:
<PropertyGroup Condition="'$(Configuration)'=='LamaDebug'">
<MetalamaDebugTransformedCode>True</MetalamaDebugTransformedCode>
</PropertyGroup>