From ce0f8310472b119a5a08b9726d207000b593abc3 Mon Sep 17 00:00:00 2001 From: "Matt Mitchell (.NET) (from Dev Box)" Date: Fri, 9 May 2025 14:15:16 -0700 Subject: [PATCH 1/2] Use Microsoft.NETCore.App.Ref version in place of legacy MicrosoftNETCoreAppPackageVersion https://github.com/dotnet/dotnet/blob/main/repo-projects/Directory.Build.props#L247-L251 The reason for this block is that repos tend to use arch specific version properties as proxy version numbers. So aspnetcore will set the runtime pack version based on the MicrosoftNETCoreAppVersion, which it typically sets based on the x64 runtime pack version. But since that's not produced in an x86 build, we jump some through VMR hoops to get this right. The stabilized build exposes a few of these cases where we incorrectly use a few properties, which is quite fixable, but overall this block caught my attention and I think we should remove it. aspnetcore seems to be the biggest user of MicrosoftNETCoreAppVersion, set to the x64 runtime pack version. I was thinking to just changing all the uses to the ref pack version, since the runtime pack and ref pack versions are always aligned. We can then get rid of this block altogether, which would be great --- eng/Dependencies.props | 2 +- eng/Versions.props | 7 --- .../SupportFiles/Directory.Build.targets | 12 ++--- eng/testing/linker/project.csproj.template | 1 - eng/testing/linker/trimmingTests.targets | 1 - .../GenerateFiles/Directory.Build.targets.in | 18 +++---- eng/tools/GenerateFiles/GenerateFiles.csproj | 1 - .../src/Microsoft.AspNetCore.App.Ref.sfxproj | 4 +- .../src/aspnetcore-base-runtime.proj | 2 +- .../src/aspnetcore-runtime-composite.proj | 4 +- .../App.Runtime/src/aspnetcore-runtime.proj | 4 +- .../Microsoft.AspNetCore.App.UnitTests.csproj | 4 +- src/Framework/test/SharedFxTests.cs | 4 +- src/Framework/test/TargetingPackTests.cs | 4 +- src/Framework/test/TestData.cs | 2 +- .../WindowsHostingBundle/Product.targets | 54 +++++++++---------- ...crosoft.DotNet.Web.ProjectTemplates.csproj | 2 +- src/SiteExtensions/LoggingBranch/LB.csproj | 2 +- 18 files changed, 59 insertions(+), 69 deletions(-) diff --git a/eng/Dependencies.props b/eng/Dependencies.props index 15355024250e..94bd8109c0c7 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -253,7 +253,7 @@ and are generated based on the last package release. --> $(MicrosoftNETCoreAppRuntimeVersion) + Condition=" $([System.String]::new('%(Identity)').StartsWith('Microsoft.NETCore.App.Runtime.')) or $([System.String]::new('%(Identity)').StartsWith('Microsoft.NETCore.App.Crossgen2.'))">$(MicrosoftNETCoreAppRefVersion) diff --git a/eng/Versions.props b/eng/Versions.props index 5a1182d5ece6..3c18a28b17bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -189,13 +189,6 @@ Versions below this comment are not managed by automation and can be changed as needed. --> - - - $(MicrosoftNETCoreAppRuntimewinx64Version) - 6.0.0 diff --git a/eng/testing/linker/SupportFiles/Directory.Build.targets b/eng/testing/linker/SupportFiles/Directory.Build.targets index 765082e447ac..68afc5df3672 100644 --- a/eng/testing/linker/SupportFiles/Directory.Build.targets +++ b/eng/testing/linker/SupportFiles/Directory.Build.targets @@ -8,10 +8,10 @@ + RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRefVersion)" /> + Version="$(MicrosoftNETCoreAppRefVersion)" /> $(MicrosoftNETCoreAppRuntimeVersion) + Condition=" '%(TargetFramework)' == '$(TargetFramework)' ">$(MicrosoftNETCoreAppRefVersion) $(MicrosoftNETCoreAppRefVersion) $(MicrosoftNETCoreAppRuntimeVersion) + '%(TargetFramework)' == '$(TargetFramework)'">$(MicrosoftNETCoreAppRefVersion) $(TargetRuntimeIdentifier) $(MicrosoftNETCoreAppRuntimeVersion) + Condition=" '%(TargetFramework)' == '$(TargetFramework)' ">$(MicrosoftNETCoreAppRefVersion) $(TargetRuntimeIdentifier) $(MicrosoftNETCoreAppRuntimeVersion) + Condition=" '%(TargetFramework)' == '$(TargetFramework)' ">$(MicrosoftNETCoreAppRefVersion) $(TargetRuntimeIdentifier) diff --git a/eng/testing/linker/project.csproj.template b/eng/testing/linker/project.csproj.template index ea368a6caa54..160271a57fb7 100644 --- a/eng/testing/linker/project.csproj.template +++ b/eng/testing/linker/project.csproj.template @@ -5,7 +5,6 @@ Exe {RuntimeIdentifier} {PublishAot} - {MicrosoftNETCoreAppRuntimeVersion} {MicrosoftNETCoreAppRefVersion} {RepoRoot} diff --git a/eng/testing/linker/trimmingTests.targets b/eng/testing/linker/trimmingTests.targets index 1018b14a641b..32235265135f 100644 --- a/eng/testing/linker/trimmingTests.targets +++ b/eng/testing/linker/trimmingTests.targets @@ -84,7 +84,6 @@ .Replace('{TargetFramework}', '%(TestConsoleApps.TargetFramework)') .Replace('{RuntimeIdentifier}','%(TestConsoleApps.TestRuntimeIdentifier)') .Replace('{PublishAot}','$(IsNativeAotTestProject)') - .Replace('{MicrosoftNETCoreAppRuntimeVersion}','$(MicrosoftNETCoreAppRuntimeVersion)') .Replace('{MicrosoftNETCoreAppRefVersion}','$(MicrosoftNETCoreAppRefVersion)') .Replace('{RepoRoot}', '$(RepoRoot)') .Replace('{ExtraTrimmerArgs}', '%(TestConsoleApps.ExtraTrimmerArgs)') diff --git a/eng/tools/GenerateFiles/Directory.Build.targets.in b/eng/tools/GenerateFiles/Directory.Build.targets.in index 26dfad97a0e8..fb93cb806019 100644 --- a/eng/tools/GenerateFiles/Directory.Build.targets.in +++ b/eng/tools/GenerateFiles/Directory.Build.targets.in @@ -54,12 +54,12 @@ + Version="${MicrosoftNETCoreAppRefVersion}" /> @@ -67,7 +67,7 @@ ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} ${MicrosoftNETCoreAppRefVersion} ${MicrosoftNETCoreAppRuntimeVersion} + '$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRefVersion} %(RuntimePackRuntimeIdentifiers);$(TargetRuntimeIdentifier) ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} $(TargetRuntimeIdentifier) ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} $(TargetRuntimeIdentifier) ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} @@ -109,13 +109,13 @@ ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} %(Crossgen2RuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier);$(TargetRuntimeIdentifier) ${MicrosoftNETCoreAppRuntimeVersion} + Condition=" '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' ">${MicrosoftNETCoreAppRefVersion} diff --git a/eng/tools/GenerateFiles/GenerateFiles.csproj b/eng/tools/GenerateFiles/GenerateFiles.csproj index dbe1c76adde2..48f57adcade4 100644 --- a/eng/tools/GenerateFiles/GenerateFiles.csproj +++ b/eng/tools/GenerateFiles/GenerateFiles.csproj @@ -23,7 +23,6 @@ MicrosoftAspNetCoreAppRefVersion=$(TargetingPackVersion); MicrosoftAspNetCoreAppRuntimeVersion=$(SharedFxVersion); MicrosoftNETCoreAppRefVersion=$(MicrosoftNETCoreAppRefVersion); - MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion); MicrosoftPlaywrightCLIVersion=$(MicrosoftPlaywrightCLIVersion); LibNetHostAppPackVersion=$(BundledNETCoreAppPackageVersion); SupportedRuntimeIdentifiers=$([MSBuild]::Escape($(SupportedRuntimeIdentifiers))); diff --git a/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj b/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj index b566e2e59267..44cd40b611d7 100644 --- a/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj +++ b/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj @@ -160,11 +160,11 @@ '%(ReferencePath.NuGetSourceType)' == 'Package' " /> - <_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(FileName)|$(MicrosoftNETCoreAppRuntimeVersion)')" + <_AspNetCoreAppPackageOverrides Include="@(ReferencePath->'%(FileName)|$(MicrosoftNETCoreAppRefVersion)')" Condition="'%(ReferencePath.NuGetPackageId)' == 'Microsoft.Internal.Runtime.AspNetCore.Transport' AND '%(ReferencePath.NuGetSourceType)' == 'Package' " /> diff --git a/src/Framework/App.Runtime/src/aspnetcore-base-runtime.proj b/src/Framework/App.Runtime/src/aspnetcore-base-runtime.proj index 842ba7c97d32..2f3f66312a3c 100644 --- a/src/Framework/App.Runtime/src/aspnetcore-base-runtime.proj +++ b/src/Framework/App.Runtime/src/aspnetcore-base-runtime.proj @@ -13,7 +13,7 @@ diff --git a/src/Framework/App.Runtime/src/aspnetcore-runtime-composite.proj b/src/Framework/App.Runtime/src/aspnetcore-runtime-composite.proj index a63ae840d277..0bda2132bba9 100644 --- a/src/Framework/App.Runtime/src/aspnetcore-runtime-composite.proj +++ b/src/Framework/App.Runtime/src/aspnetcore-runtime-composite.proj @@ -26,8 +26,8 @@ --> - dotnet-runtime-$(MicrosoftNETCoreAppRuntimeVersion)-$(TargetRuntimeIdentifier).$(ArchiveFormat) - dotnet-runtime-pgo-$(MicrosoftNETCoreAppRuntimeVersion)-$(TargetRuntimeIdentifier)$(ArchiveExtension) + dotnet-runtime-$(MicrosoftNETCoreAppRefVersion)-$(TargetRuntimeIdentifier).$(ArchiveFormat) + dotnet-runtime-pgo-$(MicrosoftNETCoreAppRefVersion)-$(TargetRuntimeIdentifier)$(ArchiveExtension) Runtime/$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)/$(DotNetRuntimeArchiveFileName) $(BaseIntermediateOutputPath)$(DotNetRuntimeArchiveFileName) diff --git a/src/Framework/App.Runtime/src/aspnetcore-runtime.proj b/src/Framework/App.Runtime/src/aspnetcore-runtime.proj index b636ddc46293..5e15187aa847 100644 --- a/src/Framework/App.Runtime/src/aspnetcore-runtime.proj +++ b/src/Framework/App.Runtime/src/aspnetcore-runtime.proj @@ -29,8 +29,8 @@ --> - dotnet-runtime-$(MicrosoftNETCoreAppRuntimeVersion)-$(TargetRuntimeIdentifier).$(ArchiveFormat) - dotnet-runtime-pgo-$(MicrosoftNETCoreAppRuntimeVersion)-$(TargetRuntimeIdentifier)$(ArchiveExtension) + dotnet-runtime-$(MicrosoftNETCoreAppRefVersion)-$(TargetRuntimeIdentifier).$(ArchiveFormat) + dotnet-runtime-pgo-$(MicrosoftNETCoreAppRefVersion)-$(TargetRuntimeIdentifier)$(ArchiveExtension) Runtime/$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)/$(DotNetRuntimeArchiveFileName) $(BaseIntermediateOutputPath)$(DotNetRuntimeArchiveFileName) diff --git a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj index eaa52b8b613c..09eeccfea525 100644 --- a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj +++ b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj @@ -46,8 +46,8 @@ <_Parameter2>$(TargetRuntimeIdentifier) - <_Parameter1>MicrosoftNETCoreAppRuntimeVersion - <_Parameter2>$(MicrosoftNETCoreAppRuntimeVersion) + <_Parameter1>MicrosoftNETCoreAppRefVersion + <_Parameter2>$(MicrosoftNETCoreAppRefVersion) <_Parameter1>SharedFrameworkBinariesFromRepo diff --git a/src/Framework/test/SharedFxTests.cs b/src/Framework/test/SharedFxTests.cs index 8aed6fa3bff5..5578643035b8 100644 --- a/src/Framework/test/SharedFxTests.cs +++ b/src/Framework/test/SharedFxTests.cs @@ -96,7 +96,7 @@ public void SharedFrameworkContainsValidRuntimeConfigFile() Assert.Equal(_expectedTfm, (string)runtimeConfig["runtimeOptions"]["tfm"]); Assert.Equal("LatestPatch", (string)runtimeConfig["runtimeOptions"]["rollForward"]); - Assert.Equal(TestData.GetMicrosoftNETCoreAppPackageVersion(), (string)runtimeConfig["runtimeOptions"]["framework"]["version"]); + Assert.Equal(TestData.GetMicrosoftNETCoreAppVersion(), (string)runtimeConfig["runtimeOptions"]["framework"]["version"]); } [Fact] @@ -165,7 +165,7 @@ public void SharedFrameworkAssembliesHaveExpectedAssemblyVersions() .Split(';', StringSplitOptions.RemoveEmptyEntries) .ToHashSet(); - var versionStringWithoutPrereleaseTag = TestData.GetMicrosoftNETCoreAppPackageVersion().Split('-', 2)[0]; + var versionStringWithoutPrereleaseTag = TestData.GetMicrosoftNETCoreAppVersion().Split('-', 2)[0]; var version = Version.Parse(versionStringWithoutPrereleaseTag); var aspnetcoreVersionString = TestData.GetSharedFxVersion().Split('-', 2)[0]; var aspnetcoreVersion = Version.Parse(aspnetcoreVersionString); diff --git a/src/Framework/test/TargetingPackTests.cs b/src/Framework/test/TargetingPackTests.cs index 080372adb0c4..bbfb80cf9c19 100644 --- a/src/Framework/test/TargetingPackTests.cs +++ b/src/Framework/test/TargetingPackTests.cs @@ -65,7 +65,7 @@ public void RefAssembliesHaveExpectedAssemblyVersions() .Split(';', StringSplitOptions.RemoveEmptyEntries) .ToHashSet(); - var versionStringWithoutPrereleaseTag = TestData.GetMicrosoftNETCoreAppPackageVersion().Split('-', 2)[0]; + var versionStringWithoutPrereleaseTag = TestData.GetMicrosoftNETCoreAppVersion().Split('-', 2)[0]; var version = Version.Parse(versionStringWithoutPrereleaseTag); var aspnetcoreVersionString = TestData.GetSharedFxVersion().Split('-', 2)[0]; var aspnetcoreVersion = Version.Parse(aspnetcoreVersionString); @@ -148,7 +148,7 @@ public void PackageOverridesContainsCorrectEntries() Assert.Equal(packageOverrideFileLines.Length, runtimeDependencies.Count + aspnetcoreDependencies.Count + 1); // PackageOverrides versions should remain at Major.Minor.0 while servicing. - var netCoreAppPackageVersion = TestData.GetMicrosoftNETCoreAppPackageVersion(); + var netCoreAppPackageVersion = TestData.GetMicrosoftNETCoreAppVersion(); Assert.True( NuGetVersion.TryParse(netCoreAppPackageVersion, out var parsedVersion), "MicrosoftNETCoreAppPackageVersion must be convertable to a NuGetVersion."); diff --git a/src/Framework/test/TestData.cs b/src/Framework/test/TestData.cs index fe88b95fcdd6..6d7176d53b31 100644 --- a/src/Framework/test/TestData.cs +++ b/src/Framework/test/TestData.cs @@ -319,7 +319,7 @@ static TestData() public static string GetDefaultNetCoreTargetFramework() => GetTestDataValue("DefaultNetCoreTargetFramework"); - public static string GetMicrosoftNETCoreAppPackageVersion() => GetTestDataValue("MicrosoftNETCoreAppRuntimeVersion"); + public static string GetMicrosoftNETCoreAppVersion() => GetTestDataValue("MicrosoftNETCoreAppRefVersion"); public static string GetReferencePackSharedFxVersion() => GetTestDataValue("ReferencePackSharedFxVersion"); diff --git a/src/Installers/Windows/WindowsHostingBundle/Product.targets b/src/Installers/Windows/WindowsHostingBundle/Product.targets index 192e36b95837..c4c54cae812d 100644 --- a/src/Installers/Windows/WindowsHostingBundle/Product.targets +++ b/src/Installers/Windows/WindowsHostingBundle/Product.targets @@ -7,31 +7,31 @@ - + DotNetRedistLtsInstallerx64 - + DotNetRedistLtsInstallerx86 - + DotNetRedistLtsInstallerarm64 - + DotNetRedistHostInstallerx64 - + DotNetRedistHostInstallerx86 - + DotNetRedistHostInstallerarm64 - + DotNetRedistHostfxrInstallerx64 - + DotNetRedistHostfxrInstallerx86 - + DotNetRedistHostfxrInstallerarm64 @@ -43,32 +43,32 @@ - - dotnet-runtime-$(MicrosoftNETCoreAppRuntimeVersion)-win-x64.msi + + dotnet-runtime-$(MicrosoftNETCoreAppRefVersion)-win-x64.msi - - dotnet-runtime-$(MicrosoftNETCoreAppRuntimeVersion)-win-x86.msi + + dotnet-runtime-$(MicrosoftNETCoreAppRefVersion)-win-x86.msi - - dotnet-runtime-$(MicrosoftNETCoreAppRuntimeVersion)-win-arm64.msi + + dotnet-runtime-$(MicrosoftNETCoreAppRefVersion)-win-arm64.msi - - dotnet-host-$(MicrosoftNETCoreAppRuntimeVersion)-win-x64.msi + + dotnet-host-$(MicrosoftNETCoreAppRefVersion)-win-x64.msi - - dotnet-host-$(MicrosoftNETCoreAppRuntimeVersion)-win-x86.msi + + dotnet-host-$(MicrosoftNETCoreAppRefVersion)-win-x86.msi - - dotnet-host-$(MicrosoftNETCoreAppRuntimeVersion)-win-arm64.msi + + dotnet-host-$(MicrosoftNETCoreAppRefVersion)-win-arm64.msi - - dotnet-hostfxr-$(MicrosoftNETCoreAppRuntimeVersion)-win-x64.msi + + dotnet-hostfxr-$(MicrosoftNETCoreAppRefVersion)-win-x64.msi - - dotnet-hostfxr-$(MicrosoftNETCoreAppRuntimeVersion)-win-x86.msi + + dotnet-hostfxr-$(MicrosoftNETCoreAppRefVersion)-win-x86.msi - - dotnet-hostfxr-$(MicrosoftNETCoreAppRuntimeVersion)-win-arm64.msi + + dotnet-hostfxr-$(MicrosoftNETCoreAppRefVersion)-win-arm64.msi diff --git a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj index 01fd5e06eafd..bc241d290ef0 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj @@ -23,7 +23,7 @@ MicrosoftIdentityWebGraphServiceClientVersion=$(MicrosoftIdentityWebGraphServiceClientVersion); MicrosoftIdentityWebUIVersion=$(MicrosoftIdentityWebUIVersion); MicrosoftIdentityWebDownstreamApiVersion=$(MicrosoftIdentityWebDownstreamApiVersion); - MicrosoftNETCoreAppRuntimeVersion=$(MicrosoftNETCoreAppRuntimeVersion); + MicrosoftNETCoreAppRefVersion=$(MicrosoftNETCoreAppRefVersion); SystemNetHttpJsonVersion=$(SystemNetHttpJsonVersion); MicrosoftGraphVersion=$(MicrosoftGraphVersion); diff --git a/src/SiteExtensions/LoggingBranch/LB.csproj b/src/SiteExtensions/LoggingBranch/LB.csproj index 09810fa61d3a..d3308c748ded 100644 --- a/src/SiteExtensions/LoggingBranch/LB.csproj +++ b/src/SiteExtensions/LoggingBranch/LB.csproj @@ -9,7 +9,7 @@ content Microsoft.AspNetCore.AzureAppServices.SiteExtension.$(AspNetCoreMajorMinorVersion).$(TargetArchitecture) $(TargetRuntimeIdentifier) - $(MicrosoftNETCoreAppRuntimeVersion) + $(MicrosoftNETCoreAppRefVersion) AzureSiteExtension true false From 9c7ea8e8f05498ae25864c3d7543f39e76d3254f Mon Sep 17 00:00:00 2001 From: "Matt Mitchell (.NET)" Date: Mon, 12 May 2025 07:37:31 -0700 Subject: [PATCH 2/2] Remove unneeded content property --- .../Microsoft.DotNet.Web.ProjectTemplates.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj index bc241d290ef0..505dff2b9a69 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj +++ b/src/ProjectTemplates/Web.ProjectTemplates/Microsoft.DotNet.Web.ProjectTemplates.csproj @@ -23,7 +23,6 @@ MicrosoftIdentityWebGraphServiceClientVersion=$(MicrosoftIdentityWebGraphServiceClientVersion); MicrosoftIdentityWebUIVersion=$(MicrosoftIdentityWebUIVersion); MicrosoftIdentityWebDownstreamApiVersion=$(MicrosoftIdentityWebDownstreamApiVersion); - MicrosoftNETCoreAppRefVersion=$(MicrosoftNETCoreAppRefVersion); SystemNetHttpJsonVersion=$(SystemNetHttpJsonVersion); MicrosoftGraphVersion=$(MicrosoftGraphVersion);