Skip to content

Move BuildWithNetFrameworkHostedCompiler to common #47067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,20 @@ Copyright (c) .NET Foundation. All rights reserved.
<UsingTask TaskName="NETSdkInformation" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
<UsingTask TaskName="ShowPreviewMessage" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />

<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Full'">
<!-- Automatically opt users into using the toolset package if they are running an MSBuild other than what this SDK was built against.
This is to reduce 'tearing'/dependency mismatch, but as always users can override this behavior by disabling the hosted compiler flag.
This is done in Common.targets so that it applies to ApiCompat which uses RoslynTargetsPath in the outer build. -->
<BuildWithNetFrameworkHostedCompiler Condition="'$(BuildWithNetFrameworkHostedCompiler)' == ''
and '$(_IsDisjointMSBuildVersion)' == 'true'
and ('$(Language)' == 'C#'
or '$(Language)' == 'VB')">true</BuildWithNetFrameworkHostedCompiler>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildWithNetFrameworkHostedCompiler)' == 'true' and '$(OS)' == 'Windows_NT'">
<RoslynTargetsPath>$(NuGetPackageRoot)\microsoft.net.sdk.compilers.toolset\$(NETCoreSdkVersion)</RoslynTargetsPath>
<_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>true</_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>
<_MicrosoftNetSdkCompilersToolsetPackageRootEmpty Condition="'$(NuGetPackageRoot)' == ''">true</_MicrosoftNetSdkCompilersToolsetPackageRootEmpty>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,6 @@ Copyright (c) .NET Foundation. All rights reserved.
</RebuildDependsOn>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Full'">
<!-- Automatically opt users into using the toolset package if they are running an MSBuild other than what this SDK was built against.
This is to reduce 'tearing'/dependency mismatch, but as always users can override this behavior by disabling the hosted compiler flag. -->
<BuildWithNetFrameworkHostedCompiler Condition="'$(BuildWithNetFrameworkHostedCompiler)' == ''
and '$(_IsDisjointMSBuildVersion)' == 'true'
and ('$(Language)' == 'C#'
or '$(Language)' == 'VB')">true</BuildWithNetFrameworkHostedCompiler>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildWithNetFrameworkHostedCompiler)' == 'true' and '$(OS)' == 'Windows_NT'">
<RoslynTargetsPath>$(NuGetPackageRoot)\microsoft.net.sdk.compilers.toolset\$(NETCoreSdkVersion)</RoslynTargetsPath>
<_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>true</_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>
<_MicrosoftNetSdkCompilersToolsetPackageRootEmpty Condition="'$(NuGetPackageRoot)' == ''">true</_MicrosoftNetSdkCompilersToolsetPackageRootEmpty>
</PropertyGroup>

<!-- NOTE: Keep in sync with https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.tasks -->
<!-- `Condition="Exists('$(RoslynTargetsPath)')` is needed because the package might not be yet downloaded during restore in VS
and we do not want to fail the restore phase because of that. -->
Expand Down
Loading