Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/core/project-sdk/msbuild-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ The following MSBuild properties are documented in this section:
- [GenerateRequiresPreviewFeaturesAttribute](#generaterequirespreviewfeaturesattribute)
- [OptimizeImplicitlyTriggeredBuild](#optimizeimplicitlytriggeredbuild)
- [DisableRuntimeMarshalling](#disableruntimemarshalling)
- [BuildWithNetFrameworkHostedCompiler](#buildwithnetframeworkhostedcompiler)
- [RoslynUseSdkCompiler](#roslynusesdkcompiler)
- [RoslynUseMSBuildCompiler](#roslynusemsbuildcompiler)

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

Expand Down Expand Up @@ -842,6 +845,27 @@ The `DisableRuntimeMarshalling` property enables you to specify that you would l
</PropertyGroup>
```

### BuildWithNetFrameworkHostedCompiler

When using .NET Framework MSBuild, `BuildWithNetFrameworkHostedCompiler=true` ensures that
a C#/VB compiler corresponding to the current SDK version is used
instead of the default version that ships with MSBuild.
When this property is set to `true`, the .NET Framework version of the compiler is used, unlike `RoslynUseSdkCompiler`.
In some cases, this behavior happens automatically when it is detected that MSBuild and SDK versions are different,
and then you can set `BuildWithNetFrameworkHostedCompiler=false` to opt out of the behavior.

### RoslynUseSdkCompiler

When using .NET Framework MSBuild, `RoslynUseSdkCompiler=true` ensures that
a C#/VB compiler corresponding to the current SDK version is used
instead of the default version that ships with MSBuild.
When this property is set to `true`, the .NET Core version of the compiler is used, unlike `BuildWithNetFrameworkHostedCompiler`.
In most cases, `RoslynUseSdkCompiler=true` is the default setting.

### RoslynUseMSBuildCompiler

`RoslynUseMSBuildCompiler=true` can be used to opt out of an implicit `RoslynUseSdkCompiler=true`.
Comment on lines +865 to +867
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Why is this property necessary? Isn't setting <RoslynUseSdkCompiler>false</RoslynUseSdkCompiler> sufficient?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be sufficient. RoslynUseMSBuildCompiler was documented by @jaredpar in https://github.com/dotnet/sdk/blob/main/documentation/general/decouple-vs-and-net-sdk.md that's why I included it in the implementation and here, but I agree it feels like we might not need it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that property already exposed? If not, I would probably remove it from this document and ideally from the implementation. Unless there's a reason why it needs to exist.


## Default item inclusion properties

The following MSBuild properties are documented in this section:
Expand Down