Skip to content

Commit e0270d6

Browse files
authored
Avoid hardcoded net472 and net9.0 TFMs in static files (#15212)
1 parent 1818ed2 commit e0270d6

File tree

38 files changed

+72
-86
lines changed

38 files changed

+72
-86
lines changed

Documentation/ArcadeSdk.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,9 +1061,6 @@ If set to `true` the GetResourceString method is not included in the generated c
10611061
#### `FlagNetStandard1XDependencies` (bool)
10621062
If set to `true` the `FlagNetStandard1xDependencies` target validates that the dependency graph doesn't contain any netstandard1.x packages.
10631063

1064-
#### `_OverrideArcadeInitializeBuildToolFramework` (string)
1065-
If this environment variable is set, the value will be used to override the default Build Tools Framework version.
1066-
10671064
<!-- Begin Generated Content: Doc Feedback -->
10681065
<sub>Was this helpful? [![Yes](https://helix.dot.net/f/ip/5?p=Documentation%5CArcadeSdk.md)](https://helix.dot.net/f/p/5?p=Documentation%5CArcadeSdk.md) [![No](https://helix.dot.net/f/in)](https://helix.dot.net/f/n/5?p=Documentation%5CArcadeSdk.md)</sub>
10691066
<!-- End Generated Content-->

eng/BuildTask.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<!-- Publish .NET Core assets and include them in the package under $(BuildTaskTargetFolder) directory. -->
9595
<Target Name="_AddBuildOutputToPackageCore" DependsOnTargets="Publish" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
9696
<PropertyGroup>
97-
<BuildTaskTargetTfmSpecificFolder Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">$(TargetFramework)</BuildTaskTargetTfmSpecificFolder>
97+
<BuildTaskTargetTfmSpecificFolder Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">net</BuildTaskTargetTfmSpecificFolder>
9898
</PropertyGroup>
9999
<ItemGroup>
100100
<TfmSpecificPackageFile Include="$(PublishDir)**"
@@ -103,9 +103,9 @@
103103
</Target>
104104

105105
<!-- Include .NET Framework build outputs in the package under $(BuildTaskTargetFolder) directory. -->
106-
<Target Name="_AddBuildOutputToPackageDesktop" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
106+
<Target Name="_AddBuildOutputToPackageDesktop" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
107107
<PropertyGroup>
108-
<BuildTaskTargetTfmSpecificFolder Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">$(TargetFramework)</BuildTaskTargetTfmSpecificFolder>
108+
<BuildTaskTargetTfmSpecificFolder Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">netframework</BuildTaskTargetTfmSpecificFolder>
109109
</PropertyGroup>
110110
<ItemGroup>
111111
<TfmSpecificPackageFile Include="$(OutputPath)**" PackagePath="$(BuildTaskTargetFolder)/$(BuildTaskTargetTfmSpecificFolder)/%(RecursiveDir)%(FileName)%(Extension)"/>

eng/common/tools.ps1

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,14 +604,7 @@ function InitializeBuildTool() {
604604
}
605605
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
606606

607-
# Use override if it exists - commonly set by source-build
608-
if ($null -eq $env:_OverrideArcadeInitializeBuildToolFramework) {
609-
$initializeBuildToolFramework="net9.0"
610-
} else {
611-
$initializeBuildToolFramework=$env:_OverrideArcadeInitializeBuildToolFramework
612-
}
613-
614-
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = $initializeBuildToolFramework }
607+
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net' }
615608
} elseif ($msbuildEngine -eq "vs") {
616609
try {
617610
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
@@ -620,7 +613,7 @@ function InitializeBuildTool() {
620613
ExitWithExitCode 1
621614
}
622615

623-
$buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472"; ExcludePrereleaseVS = $excludePrereleaseVS }
616+
$buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "netframework"; ExcludePrereleaseVS = $excludePrereleaseVS }
624617
} else {
625618
Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'."
626619
ExitWithExitCode 1
@@ -779,8 +772,10 @@ function MSBuild() {
779772
# new scripts need to work with old packages, so we need to look for the old names/versions
780773
(Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll')),
781774
(Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')),
782-
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')),
783-
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll')),
775+
776+
# This list doesn't need to be updated anymore and can eventually be removed.
777+
(Join-Path $basePath (Join-Path net9.0 'Microsoft.DotNet.ArcadeLogging.dll')),
778+
(Join-Path $basePath (Join-Path net9.0 'Microsoft.DotNet.Arcade.Sdk.dll')),
784779
(Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.ArcadeLogging.dll')),
785780
(Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.Arcade.Sdk.dll'))
786781
)

eng/common/tools.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,6 @@ function InitializeBuildTool {
339339
# return values
340340
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
341341
_InitializeBuildToolCommand="msbuild"
342-
# use override if it exists - commonly set by source-build
343-
if [[ "${_OverrideArcadeInitializeBuildToolFramework:-x}" == "x" ]]; then
344-
_InitializeBuildToolFramework="net9.0"
345-
else
346-
_InitializeBuildToolFramework="${_OverrideArcadeInitializeBuildToolFramework}"
347-
fi
348342
}
349343

350344
# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116
@@ -454,10 +448,12 @@ function MSBuild {
454448
# new scripts need to work with old packages, so we need to look for the old names/versions
455449
local selectedPath=
456450
local possiblePaths=()
457-
possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" )
458-
possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" )
459-
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" )
460-
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" )
451+
possiblePaths+=( "$toolset_dir/net/Microsoft.DotNet.ArcadeLogging.dll" )
452+
possiblePaths+=( "$toolset_dir/net/Microsoft.DotNet.Arcade.Sdk.dll" )
453+
454+
# This list doesn't need to be updated anymore and can eventually be removed.
455+
possiblePaths+=( "$toolset_dir/net9.0/Microsoft.DotNet.ArcadeLogging.dll" )
456+
possiblePaths+=( "$toolset_dir/net9.0/Microsoft.DotNet.Arcade.Sdk.dll" )
461457
possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.ArcadeLogging.dll" )
462458
possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.Arcade.Sdk.dll" )
463459
for path in "${possiblePaths[@]}"; do

src/Microsoft.DotNet.Arcade.Sdk/tools/BuildReleasePackages.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Project>
33

44
<PropertyGroup>
5-
<_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net472\Microsoft.DotNet.NuGetRepack.Tasks.dll</_NuGetRepackAssembly>
6-
<_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net9.0\Microsoft.DotNet.NuGetRepack.Tasks.dll</_NuGetRepackAssembly>
5+
<_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\netframework\Microsoft.DotNet.NuGetRepack.Tasks.dll</_NuGetRepackAssembly>
6+
<_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(NuGetPackageRoot)microsoft.dotnet.nugetrepack.tasks\$(MicrosoftDotnetNuGetRepackTasksVersion)\tools\net\Microsoft.DotNet.NuGetRepack.Tasks.dll</_NuGetRepackAssembly>
77
</PropertyGroup>
88

99
<UsingTask TaskName="Microsoft.DotNet.Tools.UpdatePackageVersionTask" AssemblyFile="$(_NuGetRepackAssembly)" />

src/Microsoft.DotNet.Arcade.Sdk/tools/BuildTasks.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Project>
33

44
<PropertyGroup>
5-
<ArcadeSdkBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)net472\Microsoft.DotNet.Arcade.Sdk.dll</ArcadeSdkBuildTasksAssembly>
6-
<ArcadeSdkBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)net9.0\Microsoft.DotNet.Arcade.Sdk.dll</ArcadeSdkBuildTasksAssembly>
5+
<ArcadeSdkBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)netframework\Microsoft.DotNet.Arcade.Sdk.dll</ArcadeSdkBuildTasksAssembly>
6+
<ArcadeSdkBuildTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)net\Microsoft.DotNet.Arcade.Sdk.dll</ArcadeSdkBuildTasksAssembly>
77
</PropertyGroup>
88

99
</Project>

src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/Directory.Build.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
</PropertyGroup>
77

88
<Import Project="../Directory.Build.props" />
9-
<Import Project="../RepoDefaults.props"/>
10-
<Import Project="../RepoLayout.props"/>
11-
<Import Project="Versions.props"/>
9+
<Import Project="../RepoDefaults.props" />
10+
<Import Project="../RepoLayout.props" />
11+
<Import Project="../TargetFrameworkDefaults.props" />
12+
<Import Project="Versions.props" />
1213

1314
</Project>

src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishArtifactsInManifest.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
-->
7777

7878
<PropertyGroup>
79-
<TargetFramework>net9.0</TargetFramework>
79+
<TargetFramework>$(NetToolCurrent)</TargetFramework>
8080
<NETCORE_ENGINEERING_TELEMETRY>Publish</NETCORE_ENGINEERING_TELEMETRY>
8181
</PropertyGroup>
8282

src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishBuildAssets.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Import Project="..\Version.BeforeCommonTargets.targets" />
2020

2121
<PropertyGroup>
22-
<TargetFramework>net472</TargetFramework>
22+
<TargetFramework>$(NetFrameworkToolCurrent)</TargetFramework>
2323
<NETCORE_ENGINEERING_TELEMETRY>Publish</NETCORE_ENGINEERING_TELEMETRY>
2424
</PropertyGroup>
2525

src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/PublishSignedAssets.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<NETCORE_ENGINEERING_TELEMETRY>Publish</NETCORE_ENGINEERING_TELEMETRY>
6-
<TargetFramework>net9.0</TargetFramework>
6+
<TargetFramework>$(NetToolCurrent)</TargetFramework>
77
</PropertyGroup>
88

99
<!--

0 commit comments

Comments
 (0)