Skip to content

Commit eb63ff3

Browse files
ericstjViktorHofer
andauthored
Move BuildWithNetFrameworkHostedCompiler to common (#47067)
Co-authored-by: Viktor Hofer <[email protected]>
1 parent 9bad1ba commit eb63ff3

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Common.targets

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,20 @@ Copyright (c) .NET Foundation. All rights reserved.
5757
<UsingTask TaskName="NETSdkInformation" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
5858
<UsingTask TaskName="ShowPreviewMessage" AssemblyFile="$(MicrosoftNETBuildTasksAssembly)" />
5959

60+
<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Full'">
61+
<!-- Automatically opt users into using the toolset package if they are running an MSBuild other than what this SDK was built against.
62+
This is to reduce 'tearing'/dependency mismatch, but as always users can override this behavior by disabling the hosted compiler flag.
63+
This is done in Common.targets so that it applies to ApiCompat which uses RoslynTargetsPath in the outer build. -->
64+
<BuildWithNetFrameworkHostedCompiler Condition="'$(BuildWithNetFrameworkHostedCompiler)' == ''
65+
and '$(_IsDisjointMSBuildVersion)' == 'true'
66+
and ('$(Language)' == 'C#'
67+
or '$(Language)' == 'VB')">true</BuildWithNetFrameworkHostedCompiler>
68+
</PropertyGroup>
69+
70+
<PropertyGroup Condition="'$(BuildWithNetFrameworkHostedCompiler)' == 'true' and '$(OS)' == 'Windows_NT'">
71+
<RoslynTargetsPath>$(NuGetPackageRoot)\microsoft.net.sdk.compilers.toolset\$(NETCoreSdkVersion)</RoslynTargetsPath>
72+
<_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>true</_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>
73+
<_MicrosoftNetSdkCompilersToolsetPackageRootEmpty Condition="'$(NuGetPackageRoot)' == ''">true</_MicrosoftNetSdkCompilersToolsetPackageRootEmpty>
74+
</PropertyGroup>
75+
6076
</Project>

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,6 @@ Copyright (c) .NET Foundation. All rights reserved.
220220
</RebuildDependsOn>
221221
</PropertyGroup>
222222

223-
<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Full'">
224-
<!-- Automatically opt users into using the toolset package if they are running an MSBuild other than what this SDK was built against.
225-
This is to reduce 'tearing'/dependency mismatch, but as always users can override this behavior by disabling the hosted compiler flag. -->
226-
<BuildWithNetFrameworkHostedCompiler Condition="'$(BuildWithNetFrameworkHostedCompiler)' == ''
227-
and '$(_IsDisjointMSBuildVersion)' == 'true'
228-
and ('$(Language)' == 'C#'
229-
or '$(Language)' == 'VB')">true</BuildWithNetFrameworkHostedCompiler>
230-
</PropertyGroup>
231-
232-
<PropertyGroup Condition="'$(BuildWithNetFrameworkHostedCompiler)' == 'true' and '$(OS)' == 'Windows_NT'">
233-
<RoslynTargetsPath>$(NuGetPackageRoot)\microsoft.net.sdk.compilers.toolset\$(NETCoreSdkVersion)</RoslynTargetsPath>
234-
<_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>true</_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage>
235-
<_MicrosoftNetSdkCompilersToolsetPackageRootEmpty Condition="'$(NuGetPackageRoot)' == ''">true</_MicrosoftNetSdkCompilersToolsetPackageRootEmpty>
236-
</PropertyGroup>
237-
238223
<!-- NOTE: Keep in sync with https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.tasks -->
239224
<!-- `Condition="Exists('$(RoslynTargetsPath)')` is needed because the package might not be yet downloaded during restore in VS
240225
and we do not want to fail the restore phase because of that. -->

0 commit comments

Comments
 (0)