Skip to content

Commit acf183a

Browse files
authored
Document RoslynCompilerType (#45802)
1 parent 62901b2 commit acf183a

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

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

+9-17
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,17 @@ 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`. For more information, see [RoslynCompilerType](#roslyncompilertype).
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.
855+
The `RoslynCompilerType` property controls the version of the C# or Visual Basic compiler. The following values are recognized:
864856

865-
### RoslynUseMSBuildCompiler
866-
867-
`RoslynUseMSBuildCompiler=true` can be used to opt out of an implicit `RoslynUseSdkCompiler=true`.
857+
- `Core`: Use the compiler that comes with the .NET SDK. This is the default since .NET 10, even when using .NET Framework MSBuild.
858+
- `Framework`: Use the compiler that comes with .NET Framework MSBuild.
859+
- `FrameworkPackage`: When using .NET Framework MSBuild, download and use a package with the .NET Framework compiler that corresponds to the .NET SDK version.
868860

869861
## Default item inclusion properties
870862

0 commit comments

Comments
 (0)