Skip to content

Commit c9e900c

Browse files
authored
Use package download in bundled dotnet tools (#46914)
1 parent c809396 commit c9e900c

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
44

5+
<PropertyGroup>
6+
<RedistLayoutPath>$(OutputPath)dotnet\</RedistLayoutPath>
7+
<SdkInternalLayoutPath>$(OutputPath)i\</SdkInternalLayoutPath>
8+
<DownloadsFolder>$(IntermediateOutputPath)downloads\</DownloadsFolder>
9+
<SdkOutputDirectory>$(RedistLayoutPath)sdk\$(Version)\</SdkOutputDirectory>
10+
</PropertyGroup>
11+
512
<Import Project="$(RepoRoot)src\Tasks\sdk-tasks\sdk-tasks.InTree.targets" />
613
<Import Project="targets\BundledTemplates.targets" />
714
<Import Project="targets\BundledManifests.targets" />

src/Installer/redist-installer/redist-installer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
5+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
56
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
67
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
78
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>

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

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22

3-
<ItemGroup Condition=" '$(IncludeAspNetCoreRuntime)' != 'false' ">
3+
<ItemGroup Condition="'$(IncludeAspNetCoreRuntime)' != 'false'">
44
<BundledDotnetTool Include="dotnet-dev-certs" Version="$(DotnetDevCertsPackageVersion)" />
55
<BundledDotnetTool Include="dotnet-user-jwts" Version="$(DotnetUserJwtsPackageVersion)" />
66
<BundledDotnetTool Include="dotnet-user-secrets" Version="$(DotnetUserSecretsPackageVersion)" ObsoletesCliTool="Microsoft.Extensions.SecretManager.Tools" />
@@ -9,34 +9,24 @@
99
<ItemGroup>
1010
<BundledDotnetTool Update="@(BundledDotnetTool)">
1111
<PackagePathRelativeToPackageRoot>%(Identity)/%(Version)/</PackagePathRelativeToPackageRoot>
12-
<RestoredPackagePath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(PackagePathRelativeToPackageRoot)', '').ToLower())/</RestoredPackagePath>
12+
<RestoredPackagePath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(PackagePathRelativeToPackageRoot)', '').ToLowerInvariant())/</RestoredPackagePath>
1313
<NupkgPathRelativeToPackageRoot>%(Identity)/%(Version)/%(Identity).%(Version).nupkg</NupkgPathRelativeToPackageRoot>
14-
<RestoredNupkgPath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(NupkgPathRelativeToPackageRoot)', '').ToLower())</RestoredNupkgPath>
14+
<RestoredNupkgPath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(NupkgPathRelativeToPackageRoot)', '').ToLowerInvariant())</RestoredNupkgPath>
1515
</BundledDotnetTool>
1616
</ItemGroup>
1717

18-
<Target Name="LayoutBundledTools" DependsOnTargets="SetupBundledComponents">
19-
<ItemGroup>
20-
<BundledToolLayoutProject Include="$(MSBuildThisFileDirectory)..\projects\DownloadPackage.csproj">
21-
<!-- For this unique RestoreProjectStyle, see: https://aka.ms/global-tools-nuget -->
22-
<Properties>
23-
PackageToRestore=%(BundledDotnetTool.Identity);
24-
PackageVersionToRestore=%(BundledDotnetTool.Version);
25-
TargetFramework=$(TargetFramework);
26-
RestoreProjectStyle=DotnetToolReference
27-
</Properties>
28-
</BundledToolLayoutProject>
29-
</ItemGroup>
30-
31-
<MSBuild Projects="@(BundledToolLayoutProject)" />
18+
<ItemGroup>
19+
<PackageDownload Include="@(BundledDotnetTool)" Version="[%(Version)]" />
20+
</ItemGroup>
3221

22+
<Target Name="LayoutBundledTools" Condition="'@(BundledDotnetTool)' != ''">
3323
<ItemGroup>
3424
<BundledToolFiles Include="%(BundledDotnetTool.RestoredPackagePath)\**\*.*" PackageToRestore="%(BundledDotnetTool.Identity)" PackageVersionToRestore="%(BundledDotnetTool.Version)" />
3525
<BundledToolFiles Remove="%(BundledDotnetTool.RestoredPackagePath)\*.*" />
3626
</ItemGroup>
3727

3828
<Copy SourceFiles="@(BundledToolFiles)"
39-
DestinationFiles="@(BundledToolFiles->'$(SdkOutputDirectory)DotnetTools/%(PackageToRestore)\%(PackageVersionToRestore)\%(RecursiveDir)%(Filename)%(Extension)')"
29+
DestinationFiles="@(BundledToolFiles->'$(SdkOutputDirectory)DotnetTools\%(PackageToRestore)\%(PackageVersionToRestore)\%(RecursiveDir)%(Filename)%(Extension)')"
4030
SkipUnchangedFiles="true" />
4131
</Target>
4232

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<Project TreatAsLocalProperty="PublicBaseURL">
22

3-
<PropertyGroup>
4-
<RedistLayoutPath>$(BaseOutputPath)$(Configuration)\dotnet\</RedistLayoutPath>
5-
<SdkInternalLayoutPath>$(BaseOutputPath)$(Configuration)\i\</SdkInternalLayoutPath>
6-
<DownloadsFolder>$(IntermediateOutputPath)downloads\</DownloadsFolder>
7-
</PropertyGroup>
8-
93
<PropertyGroup>
104
<!-- Blob storage directories are not stabilized, so these must refer to a package that does not stabilize -->
115
<!-- In unified build, the layout does match, so use the runtime package versions rather than the VS redist versions -->
@@ -21,8 +15,6 @@
2115

2216
<Target Name="SetupBundledComponents">
2317
<PropertyGroup>
24-
<SdkOutputDirectory>$(RedistLayoutPath)sdk\$(Version)\</SdkOutputDirectory>
25-
2618
<InternalBuild Condition="$(SYSTEM_TEAMPROJECT) == 'internal'">true</InternalBuild>
2719
<InternalBaseURL Condition="$(SYSTEM_TEAMPROJECT) == 'internal'">https://dotnetbuilds.blob.core.windows.net/internal/</InternalBaseURL>
2820

0 commit comments

Comments
 (0)