Skip to content

Commit 8ab5945

Browse files
authored
Use PackageDownload in Crossgen.targets (#46913)
1 parent 3be5038 commit 8ab5945

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

src/Installer/redist-installer/Directory.Build.props

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,19 @@
4646
)">true</SkipBuildingInstallers>
4747
<SkipBuildingInstallers Condition="'$(SkipBuildingInstallers)' == ''">false</SkipBuildingInstallers>
4848

49-
<UsePortableLinuxSharedFramework Condition="'$(UsePortableLinuxSharedFramework)' == '' AND '$(IsLinux)' == 'True' AND !$(Rid.StartsWith('linux-musl'))">true</UsePortableLinuxSharedFramework>
49+
<!-- Use the portable "linux-x64" Rid when downloading Linux shared framework compressed file. -->
50+
<UsePortableLinuxSharedFramework Condition="'$(UsePortableLinuxSharedFramework)' == '' AND '$(IsLinux)' == 'true' AND !$(Rid.StartsWith('linux-musl'))">true</UsePortableLinuxSharedFramework>
5051
<HighEntropyVA>true</HighEntropyVA>
5152
</PropertyGroup>
5253

54+
<PropertyGroup>
55+
<NetRuntimeRid Condition="'$(NetRuntimeRid)' == ''">$(HostRid)</NetRuntimeRid>
56+
<NetRuntimeRid Condition=" ('$(OSName)' == 'win' or '$(OSName)' == 'osx' or '$(OSName)' == 'freebsd' or '$(OSName)' == 'illumos' or '$(OSName)' == 'solaris') and '$(DotNetBuildSourceOnly)' != 'true' ">$(OSName)-$(Architecture)</NetRuntimeRid>
57+
<NetRuntimeRid Condition="'$(DotNetBuild)' != 'true' and $(NetRuntimeRid.StartsWith('mariner.2.0'))">$(HostRid.Replace('mariner.2.0', 'cm.2'))</NetRuntimeRid>
58+
59+
<SharedFrameworkRid>$(NetRuntimeRid)</SharedFrameworkRid>
60+
<SharedFrameworkRid Condition="$(ProductMonikerRid.StartsWith('linux-musl'))">$(ProductMonikerRid)</SharedFrameworkRid>
61+
<SharedFrameworkRid Condition=" '$(UsePortableLinuxSharedFramework)' == 'true' ">linux-$(Architecture)</SharedFrameworkRid>
62+
</PropertyGroup>
63+
5364
</Project>

src/Installer/redist-installer/targets/Crossgen.targets

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
<Project>
22

3+
<PropertyGroup>
4+
<Crossgen2Rid>$(HostOSName)-$(BuildArchitecture)</Crossgen2Rid>
5+
<Crossgen2Rid Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(SharedFrameworkRid)</Crossgen2Rid>
6+
7+
<RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(Crossgen2Rid)</RuntimeNETCrossgenPackageName>
8+
</PropertyGroup>
9+
10+
<!-- Download the runtime package with the crossgen executable in it -->
11+
<ItemGroup>
12+
<PackageDownload Include="$(RuntimeNETCrossgenPackageName)" Version="[$(MicrosoftNETCoreAppRuntimePackageVersion)]" />
13+
</ItemGroup>
14+
315
<!-- Crossgen is currently not supported on the s390x, ppc64le architecture as using mono instead of CoreCLR. -->
416
<Target Name="CrossgenLayout"
517
Condition="'$(DISABLE_CROSSGEN)' == '' AND '$(Architecture)' != 's390x' AND '$(Architecture)' != 'ppc64le'">
618
<PropertyGroup>
7-
<RuntimeNETCrossgenPackageName>microsoft.netcore.app.crossgen2.$(Crossgen2Rid)</RuntimeNETCrossgenPackageName>
819
<CrossgenPath>$(NuGetPackageRoot)$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension)</CrossgenPath>
920
<CreateCrossgenSymbols Condition="'$(CreateCrossgenSymbols)' == ''">true</CreateCrossgenSymbols>
1021
<!-- When ingesting stable pgo instrumented binaries, the shared framework will be a non-stable version,
@@ -13,19 +24,6 @@
1324
<SharedFrameworkNameVersionPath Condition=" '$(PgoInstrument)' == 'true' ">$(RedistLayoutPath)shared/$(SharedFrameworkName)/$(VSRedistCommonNetCoreTargetingPackx64100PackageVersion)</SharedFrameworkNameVersionPath>
1425
</PropertyGroup>
1526

16-
<!-- Download the runtime package with the crossgen executable in it -->
17-
<ItemGroup>
18-
<CrossGenDownloadPackageProject Include="$(MSBuildThisFileDirectory)..\projects\DownloadPackage.csproj">
19-
<Properties>
20-
PackageToRestore=$(RuntimeNETCrossgenPackageName);
21-
PackageVersionToRestore=$(MicrosoftNETCoreAppRuntimePackageVersion);
22-
TargetFramework=$(TargetFramework)
23-
</Properties>
24-
</CrossGenDownloadPackageProject>
25-
</ItemGroup>
26-
27-
<MSBuild Projects="@(CrossGenDownloadPackageProject)" />
28-
2927
<!-- This PropertyGroup contains the paths to the various SDK tooling that should be
3028
cross-genned. This tooling multi-targets, and we only want to cross-gen the .NET Core
3129
targeted bits. Below, this propertygroup is used to verify that these paths exist as expected,

src/Installer/redist-installer/targets/GenerateLayout.targets

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
<!-- MSBuild removes the '//' slashes when passing PublicBaseURL from the outer to the inner build. -->
3333
<PublicBaseURL Condition="$(PublicBaseURL.StartsWith('file:')) and '$(OS)' != 'Windows_NT'">$([System.Text.RegularExpressions.Regex]::Replace('$(PublicBaseURL)', '%28file:\/{1,}%29%28.+%29', 'file:///%242'))</PublicBaseURL>
3434

35-
<NetRuntimeRid Condition="'$(NetRuntimeRid)' == ''">$(HostRid)</NetRuntimeRid>
36-
<NetRuntimeRid Condition=" ('$(OSName)' == 'win' or '$(OSName)' == 'osx' or '$(OSName)' == 'freebsd' or '$(OSName)' == 'illumos' or '$(OSName)' == 'solaris') and '$(DotNetBuildSourceOnly)' != 'true' ">$(OSName)-$(Architecture)</NetRuntimeRid>
37-
<NetRuntimeRid Condition="'$(DotNetBuild)' != 'true' and $(NetRuntimeRid.StartsWith('mariner.2.0'))">$(HostRid.Replace('mariner.2.0', 'cm.2'))</NetRuntimeRid>
38-
3935
<!-- only the runtime OSX .pkgs have a `-internal` suffix -->
4036
<InstallerStartSuffix Condition="$([MSBuild]::IsOSPlatform('OSX'))">-internal</InstallerStartSuffix>
4137

@@ -68,17 +64,10 @@
6864
<DownloadedNetStandardTargetingPackInstallerFileName Condition="'$(SharedFrameworkInstallerFileRid)' == 'osx-arm64'">netstandard-targeting-pack-$(NETStandardLibraryRefPackageVersion)-osx-x64$(InstallerExtension)</DownloadedNetStandardTargetingPackInstallerFileName>
6965
<NetStandardTargetingPackTargetFramework>netstandard$(NETStandardLibraryRefPackageVersion.Split('.')[0])$(NETStandardLibraryRefPackageVersion.Split('.')[1])</NetStandardTargetingPackTargetFramework>
7066

71-
<!-- Use the portable "linux-x64" Rid when downloading Linux shared framework compressed file. -->
72-
<SharedFrameworkRid>$(NetRuntimeRid)</SharedFrameworkRid>
73-
<SharedFrameworkRid Condition="$(ProductMonikerRid.StartsWith('linux-musl'))">$(ProductMonikerRid)</SharedFrameworkRid>
74-
<SharedFrameworkRid Condition=" '$(UsePortableLinuxSharedFramework)' == 'true' ">linux-$(Architecture)</SharedFrameworkRid>
7567
<CombinedFrameworkHostArchiveFileName Condition=" '$(PgoInstrument)' != 'true' ">dotnet-runtime-$(MicrosoftNETCoreAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</CombinedFrameworkHostArchiveFileName>
7668
<CombinedFrameworkHostArchiveFileName Condition=" '$(PgoInstrument)' == 'true' ">dotnet-runtime$(PgoTerm)-$(VSRedistCommonNetCoreSharedFrameworkx64100PackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</CombinedFrameworkHostArchiveFileName>
7769
<WinFormsAndWpfSharedFxArchiveFileName>windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</WinFormsAndWpfSharedFxArchiveFileName>
7870

79-
<Crossgen2Rid>$(HostOSName)-$(BuildArchitecture)</Crossgen2Rid>
80-
<Crossgen2Rid Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(SharedFrameworkRid)</Crossgen2Rid>
81-
8271
<AspNetCoreInstallerRid Condition="'$(AspNetCoreInstallerRid)' == ''">$(SharedFrameworkRid)</AspNetCoreInstallerRid>
8372
<AspNetCoreArchiveRid>$(AspNetCoreInstallerRid)</AspNetCoreArchiveRid>
8473
<AspNetCoreInstallerRid Condition="('$(InstallerExtension)' == '.deb' OR '$(InstallerExtension)' == '.rpm') AND '$(Architecture)' != 'arm64'">x64</AspNetCoreInstallerRid>

0 commit comments

Comments
 (0)