Skip to content

Commit ede1780

Browse files
authored
Document RoslynCompilerType
1 parent 240ecce commit ede1780

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

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

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,7 @@ The following MSBuild properties are documented in this section:
679679
- [OptimizeImplicitlyTriggeredBuild](#optimizeimplicitlytriggeredbuild)
680680
- [DisableRuntimeMarshalling](#disableruntimemarshalling)
681681
- [BuildWithNetFrameworkHostedCompiler](#buildwithnetframeworkhostedcompiler)
682-
- [RoslynUseSdkCompiler](#roslynusesdkcompiler)
683-
- [RoslynUseMSBuildCompiler](#roslynusemsbuildcompiler)
682+
- [RoslynCompilerType](#roslyncompilertype)
684683

685684
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).
686685

@@ -847,24 +846,16 @@ The `DisableRuntimeMarshalling` property enables you to specify that you would l
847846

848847
### BuildWithNetFrameworkHostedCompiler
849848

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.
849+
Specifying `BuildWithNetFrameworkHostedCompiler=true` is the equivalent of specifying `RoslynCompilerType=FrameworkPackage`, see below.
850+
Specifying `BuildWithNetFrameworkHostedCompiler=false` ensures the automatic opt in to `RoslynCompilerType=FrameworkPackage` does not happen.
851+
If `RoslynCompilerType` is specified explicitly, `BuildWithNetFrameworkHostedCompiler` has no effect.
856852

857-
### RoslynUseSdkCompiler
853+
### RoslynCompilerType
858854

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`.
855+
The `RoslynCompilerType` property controls version of C#/VB compiler. These values are recognized:
856+
- `Core`: Use the compiler that comes with the .NET SDK. This is the default since .NET 10, even when using .NET Framework MSBuild.
857+
- `Framework`: Use the compiler that comes with .NET Framework MSBuild.
858+
- `FrameworkPackage`: When using .NET Framework MSBuild, download and use a package with .NET Framework compiler corresponding to the .NET SDK version.
868859

869860
## Default item inclusion properties
870861

0 commit comments

Comments
 (0)