Skip to content

Commit adbeb05

Browse files
authored
Document BuildWithNetFrameworkHostedCompiler and friends (#45620)
1 parent 344a334 commit adbeb05

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/core/project-sdk/msbuild-props.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@ The following MSBuild properties are documented in this section:
678678
- [GenerateRequiresPreviewFeaturesAttribute](#generaterequirespreviewfeaturesattribute)
679679
- [OptimizeImplicitlyTriggeredBuild](#optimizeimplicitlytriggeredbuild)
680680
- [DisableRuntimeMarshalling](#disableruntimemarshalling)
681+
- [BuildWithNetFrameworkHostedCompiler](#buildwithnetframeworkhostedcompiler)
682+
- [RoslynUseSdkCompiler](#roslynusesdkcompiler)
683+
- [RoslynUseMSBuildCompiler](#roslynusemsbuildcompiler)
681684

682685
C# compiler options, such as `LangVersion` and `Nullable`, can also be specified as MSBuild properties in your project file. For more information, see [C# compiler options](../../csharp/language-reference/compiler-options/index.md).
683686

@@ -842,6 +845,27 @@ The `DisableRuntimeMarshalling` property enables you to specify that you would l
842845
</PropertyGroup>
843846
```
844847

848+
### BuildWithNetFrameworkHostedCompiler
849+
850+
When using .NET Framework MSBuild, `BuildWithNetFrameworkHostedCompiler=true` ensures that
851+
a C#/VB compiler corresponding to the current SDK version is used
852+
instead of the default version that ships with MSBuild.
853+
When this property is set to `true`, the .NET Framework version of the compiler is used, unlike `RoslynUseSdkCompiler`.
854+
In some cases, this behavior happens automatically when it is detected that MSBuild and SDK versions are different,
855+
and then you can set `BuildWithNetFrameworkHostedCompiler=false` to opt out of the behavior.
856+
857+
### RoslynUseSdkCompiler
858+
859+
When using .NET Framework MSBuild, `RoslynUseSdkCompiler=true` ensures that
860+
a C#/VB compiler corresponding to the current SDK version is used
861+
instead of the default version that ships with MSBuild.
862+
When this property is set to `true`, the .NET Core version of the compiler is used, unlike `BuildWithNetFrameworkHostedCompiler`.
863+
In most cases, `RoslynUseSdkCompiler=true` is the default setting.
864+
865+
### RoslynUseMSBuildCompiler
866+
867+
`RoslynUseMSBuildCompiler=true` can be used to opt out of an implicit `RoslynUseSdkCompiler=true`.
868+
845869
## Default item inclusion properties
846870

847871
The following MSBuild properties are documented in this section:

0 commit comments

Comments
 (0)