Skip to content

Commit a8a9e00

Browse files
authored
[release/3.1] Target 3.1.0 shared framework in global tools (#27598)
- #19108 - ensure the packaged runtimeconfig.json file uses the 3.1.0 shared framework - disable `$(TargetLatestDotNetRuntime)` in tool projects - skip `@(FrameworkReference)` item update if `$(TargetLatestDotNetRuntime)` is disabled nit: Move `$(PackAsTool)` settings together
1 parent 669e523 commit a8a9e00

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

Directory.Build.targets

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
<SuppressDependenciesWhenPacking Condition="'$(SuppressDependenciesWhenPacking)' == '' AND '$(IsAnalyzersProject)' == 'true'">true</SuppressDependenciesWhenPacking>
4040
</PropertyGroup>
4141

42-
<PropertyGroup Condition="'$(PackAsTool)' == 'true' AND '$(IsShippingPackage)' == 'true'">
43-
<!-- This is a requirement for Microsoft tool packages only. -->
44-
<PackAsToolShimRuntimeIdentifiers>win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
45-
</PropertyGroup>
46-
4742
<PropertyGroup Condition=" '$(MSBuildProjectExtension)' == '.csproj' ">
4843
<PackageId Condition=" '$(PackageId)' == '' ">$(AssemblyName)</PackageId>
4944
<IsPackable Condition="'$(IsPackable)' == '' AND ( '$(IsTestProject)' == 'true' OR '$(IsTestAssetProject)' == 'true' OR '$(IsBenchmarkProject)' == 'true' OR '$(IsSampleProject)' == 'true' OR '$(IsReferenceAssemblyProject)' == 'true' ) ">false</IsPackable>
@@ -92,7 +87,7 @@
9287
<IsImplementationProject Condition=" '$(IsImplementationProject)' == '' AND '$(IsAnalyzersProject)' != 'true' AND '$(IsTestAssetProject)' != 'true' AND '$(IsTestProject)' != 'true' AND '$(IsBenchmarkProject)' != 'true' AND '$(IsSampleProject)' != 'true' AND '$(IsReferenceAssemblyProject)' != 'true' ">true</IsImplementationProject>
9388

9489
<!-- This determines whether a project is available as a <Reference> to other projects in this repo. -->
95-
<IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND '$(IsImplementationProject)' == 'true' AND '$(PackAsTool)' != 'true' ">true</IsProjectReferenceProvider>
90+
<IsProjectReferenceProvider Condition=" '$(IsProjectReferenceProvider)' == '' AND '$(IsImplementationProject)' == 'true' ">true</IsProjectReferenceProvider>
9691

9792
<HasReferenceAssembly
9893
Condition=" '$(HasReferenceAssembly)' == '' AND '$(IsProjectReferenceProvider)' == 'true' AND '$(IsAspNetCoreApp)' == 'true' ">true</HasReferenceAssembly>

eng/Workarounds.targets

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
<!-- Reference base shared framework at incoming dependency flow version, not bundled sdk version. -->
1010
<FrameworkReference
1111
Update="Microsoft.NETCore.App"
12-
Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"
12+
Condition=" '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)' AND '$(TargetLatestDotNetRuntime)' != 'false' "
1313
RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimeVersion)"
14-
TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)"
15-
/>
14+
TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)" />
1615
</ItemGroup>
1716

1817
<!--

src/Tools/Directory.Build.targets

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
<Project>
2-
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
3-
4-
<PropertyGroup>
5-
<UseLatestPackageReferences Condition=" '$(PackAsTool)' == 'true' ">true</UseLatestPackageReferences>
2+
<PropertyGroup Condition=" '$(PackAsTool)' == 'true' ">
3+
<!-- Microsoft tool packages are required to target both x64 and x86. -->
4+
<PackAsToolShimRuntimeIdentifiers Condition=" '$(IsShippingPackage)' == 'true' ">win-x64;win-x86</PackAsToolShimRuntimeIdentifiers>
5+
<!-- None of the tool projects are project reference providers. -->
6+
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
7+
<!--
8+
Target the default version of .NET Core in tool projects to maximize the compatible environments. Must be set
9+
before importing root Directory.Build.targets.
10+
-->
11+
<TargetLatestDotNetRuntime Condition=" '$(IsServicingBuild)' == 'true' ">false</TargetLatestDotNetRuntime>
12+
<!-- Tool projects publish before packing. Packages should contain the latest bits. -->
13+
<UseLatestPackageReferences>true</UseLatestPackageReferences>
614
</PropertyGroup>
715

16+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)..\, Directory.Build.targets))\Directory.Build.targets" />
17+
818
<Target Name="CleanPublishDir" AfterTargets="CoreClean">
919
<RemoveDir Directories="$(PublishDir)" />
1020
</Target>

0 commit comments

Comments
 (0)