Property directive

The property directive is used to set MSBuild property values. This is equivalent to specifying properties in a .csproj file.

Usage

The directive uses the format PropertyName=PropertyValue.

Set MSBuild property

#:property LangVersion=preview

This is equivalent to the following .csproj:

<PropertyGroup>
  <LangVersion>preview</LangVersion>
</PropertyGroup>

Multiple properties

You can specify multiple properties by using multiple directives:

#:property LangVersion=preview
#:property TargetFramework=net10.0
#:property PublishAot=false

See also