Skip to content

Commit 7db3ce2

Browse files
authored
Fixes for the Installer packages (#15247)
1 parent dd716e4 commit 7db3ce2

File tree

7 files changed

+53
-51
lines changed

7 files changed

+53
-51
lines changed

src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/Directory.Build.targets

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,4 @@
44
<!-- Set up build infra for the acquire-* projects. -->
55

66
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
7-
8-
<PropertyGroup>
9-
<GenerateInstallers>true</GenerateInstallers>
10-
</PropertyGroup>
11-
12-
<Import Project="$(MSBuildThisFileDirectory)..\installer.singlerid.targets" Condition="'$(_InstallerTargetsImported)' != 'true'" />
13-
147
</Project>

src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-nuget-exe/acquire-nuget-exe.proj

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@
33

44
<UsingTask TaskName="DownloadFile" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
55

6+
<PropertyGroup>
7+
<!-- Using 3.5.0 to workaround https://github.com/NuGet/Home/issues/5016 -->
8+
<NuGetExeDownloadUrl>https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe</NuGetExeDownloadUrl>
9+
<NuGetExeToolDir>$(BaseIntermediateOutputPath)nuget\</NuGetExeToolDir>
10+
<NuGetExeFile>$(NuGetExeToolDir)NuGet.exe</NuGetExeFile>
11+
</PropertyGroup>
612
<!--
713
Acquire NuGet.exe, if not present.
814
-->
9-
<Target Name="AcquireNuGetExeCore"
10-
Condition="!Exists('$(NuGetExeFile)')"
11-
DependsOnTargets="_GetAcquireNuGetExeProperties">
15+
<Target Name="DownloadNugetExe"
16+
Condition="!Exists('$(NuGetExeFile)')">
1217
<MakeDir Directories="$(NuGetExeToolDir)" />
1318
<DownloadFile
1419
Uri="$(NuGetExeDownloadUrl)"
1520
DestinationPath="$(NuGetExeFile)"
1621
Overwrite="true" />
1722
</Target>
1823

24+
<Target Name="AcquireNuGetExeCore"
25+
DependsOnTargets="DownloadNugetExe"
26+
Returns="$(NuGetExeFile)" />
27+
1928
</Project>

src/Microsoft.DotNet.Build.Tasks.Installers/build/acquisition/acquire-wix/acquire-wix.proj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,23 @@
88
99
Adapted from https://github.com/dotnet/core-sdk/blob/6aed0cd3614f9b740cfb3f21fdb795bab53ef7e9/src/redist/targets/GenerateMSIs.targets#L80-L102
1010
-->
11+
<PropertyGroup>
12+
<_WixIntermediateOutputPath>$(BaseIntermediateOutputPath)wix</_WixIntermediateOutputPath>
13+
</PropertyGroup>
14+
15+
<PropertyGroup>
16+
<WixVersion>3.14.1-9323.2545153</WixVersion>
17+
<WixToolsDir>$(BaseIntermediateOutputPath)WixTools.$(WixVersion)/</WixToolsDir>
18+
19+
<WixDownloadFilename>Microsoft.Signed.Wix-$(WixVersion).zip</WixDownloadFilename>
20+
<WixDownloadUrl>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/wix/$(WixDownloadFilename)</WixDownloadUrl>
21+
<WixDestinationPath>$(WixToolsDir)$(WixDownloadFilename)</WixDestinationPath>
22+
<WixDownloadSentinel>$(WixToolsDir)$(WixDownloadFilename).sentinel</WixDownloadSentinel>
23+
</PropertyGroup>
1124
<Target Name="AcquireWixCore"
12-
DependsOnTargets="GetAcquireWixProperties"
1325
Inputs="$(WixDownloadSentinel)"
14-
Outputs="$(WixDestinationPath)">
26+
Outputs="$(WixDestinationPath)"
27+
Returns="$(WixToolsDir)">
1528
<!-- Setup sentinel to take advantage of incrementality -->
1629
<MakeDir Directories="$(WixToolsDir)" />
1730
<WriteLinesToFile

src/Microsoft.DotNet.Build.Tasks.Installers/build/bundle.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@
8080
<ItemGroup Condition="'$(GenerateExeBundle)' == 'true'">
8181
<BundleComponentReference>
8282
<Targets>CreateWixInstaller</Targets>
83-
<AdditionalProperties>GenerateMSI=true</AdditionalProperties>
83+
<AdditionalProperties>_IsIndividualInstallerBuild=true;GenerateMSI=true</AdditionalProperties>
8484
<RemoveProperties>GenerateExeBundle</RemoveProperties>
8585
</BundleComponentReference>
8686
</ItemGroup>
8787
<ItemGroup Condition="'$(GeneratePkgBundle)' == 'true'">
8888
<BundleComponentReference>
8989
<Targets>CreatePkg</Targets>
90-
<AdditionalProperties>GeneratePkg=true</AdditionalProperties>
90+
<AdditionalProperties>_IsIndividualInstallerBuild=true;GeneratePkg=true</AdditionalProperties>
9191
<RemoveProperties>GeneratePkgBundle</RemoveProperties>
9292
</BundleComponentReference>
9393
</ItemGroup>

src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.build.targets

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
<InstallerBuildPart>$(Version)-$(TargetRuntimeOS)-$(InstallerTargetArchitecture)</InstallerBuildPart>
5656
</PropertyGroup>
5757
<PropertyGroup Condition="'$(GenerateDeb)' == 'true' or '$(GenerateRpm)' == 'true'">
58-
<_InstallerArchSuffix>$(TargetArchitecture)</_InstallerArchSuffix>
59-
<_InstallerArchSuffix Condition="'$(BuildRpmPackage)' == 'true' and '$(TargetArchitecture)' == 'arm64'">aarch64</_InstallerArchSuffix>
58+
<_InstallerArchSuffix>$(InstallerTargetArchitecture)</_InstallerArchSuffix>
59+
<_InstallerArchSuffix Condition="'$(BuildRpmPackage)' == 'true' and '$(InstallerTargetArchitecture)' == 'arm64'">aarch64</_InstallerArchSuffix>
6060
<InstallerBuildPart>$(Version)-$(_InstallerArchSuffix)</InstallerBuildPart>
6161
<InstallerBuildPart Condition="'$(PackageTargetOS)' != ''">$(Version)-$(PackageTargetOS)-$(_InstallerArchSuffix)</InstallerBuildPart>
6262
</PropertyGroup>
@@ -257,15 +257,21 @@
257257
DestinationFiles="$(_LayoutControlRoot)postinst"
258258
OverwriteReadOnlyFiles="True"
259259
SkipUnchangedFiles="True"
260-
UseHardlinksIfPossible="True" />
260+
UseHardlinksIfPossible="True"
261+
Condition="'@(LinuxPostInstallScript)' != ''" />
262+
263+
<Exec Command="chmod ugo+x '$(_LayoutControlRoot)postinst'"
264+
Condition="'@(LinuxPostInstallScript)' != ''" />
261265

262266
<Copy SourceFiles="@(LinuxPostRemoveScript)"
263267
DestinationFiles="$(_LayoutControlRoot)postrm"
264268
OverwriteReadOnlyFiles="True"
265269
SkipUnchangedFiles="True"
266-
UseHardlinksIfPossible="True" />
270+
UseHardlinksIfPossible="True"
271+
Condition="'@(LinuxPostRemoveScript)' != ''"/>
267272

268-
<Exec Command="chmod ugo+x '$(_LayoutControlRoot)postinst' '$(_LayoutControlRoot)postrm'" />
273+
<Exec Command="chmod ugo+x '$(_LayoutControlRoot)postrm'"
274+
Condition="'@(LinuxPostRemoveScript)' != ''" />
269275

270276
<Exec Command="tar -C '$(_LayoutControlRoot)' -czf '$(_LayoutDirectory)/control.tar.gz' ."
271277
IgnoreExitCode="true"

src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.targetos.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<TargetRuntimeOS>$(InstallerRuntimeIdentifier.Substring(0, $(InstallerRuntimeIdentifier.LastIndexOf('-'))))</TargetRuntimeOS>
44
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">$(InstallerRuntimeIdentifier.Substring($(InstallerRuntimeIdentifier.LastIndexOf('-'))).TrimStart('-'))</TargetArchitecture>
5+
<InstallerTargetArchitecture Condition="'$(InstallerTargetArchitecture)' == ''">$(TargetArchitecture)</InstallerTargetArchitecture>
56
</PropertyGroup>
67

78
<Target Name="_GetTargetOSArchInfo">

src/Microsoft.DotNet.Build.Tasks.Installers/build/wix/wix.targets

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,26 @@
1111
<!--
1212
Acquire WiX tools, if not present.
1313
-->
14-
<Target Name="AcquireWix"
15-
DependsOnTargets="GetAcquireWixProperties">
14+
<Target Name="_AcquireWix">
1615
<MSBuild
17-
Projects="$(AcquireWixProjectFile)"
16+
Projects="$(MSBuildThisFileDirectory)..\acquisition\acquire-wix\acquire-wix.proj"
1817
Targets="AcquireWixCore"
1918
Properties="BaseIntermediateOutputPath=$(BaseIntermediateOutputPath);
20-
RepoRoot=$(RepoRoot)" />
21-
</Target>
22-
23-
<Target Name="GetAcquireWixProperties">
19+
RepoRoot=$(RepoRoot)">
20+
<Output TaskParameter="TargetOutputs" PropertyName="WixToolsDir" />
21+
</MSBuild>
2422

2523
<PropertyGroup>
2624
<_WixIntermediateOutputPath>$(BaseIntermediateOutputPath)wix</_WixIntermediateOutputPath>
2725
</PropertyGroup>
2826

2927
<PropertyGroup>
30-
<WixVersion>3.14.1-9323.2545153</WixVersion>
31-
<WixToolsDir>$(BaseIntermediateOutputPath)WixTools.$(WixVersion)/</WixToolsDir>
32-
<!-- Used in WiX targets to locate files. -->
3328
<WixInstallPath>$(WixToolsDir)</WixInstallPath>
3429
<WixTargetsPath>$(WixToolsDir)wix.targets</WixTargetsPath>
3530
<WixObjDir>$(IntermediateOutputPath)/wix/</WixObjDir>
3631
<WixObjDir Condition="'$(RuntimeIdentifier)' == ''">$(IntermediateOutputPath)/$(InstallerRuntimeIdentifier)/wix/</WixObjDir>
3732
<LightCommandObjDir>$(IntermediateOutputPath)/lightcommand/</LightCommandObjDir>
3833
<MsiArch>$(InstallerTargetArchitecture)</MsiArch>
39-
40-
<AcquireWixProjectFile>$(MSBuildThisFileDirectory)..\acquisition\acquire-wix\acquire-wix.proj</AcquireWixProjectFile>
41-
<WixDownloadFilename>Microsoft.Signed.Wix-$(WixVersion).zip</WixDownloadFilename>
42-
<WixDownloadUrl>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/wix/$(WixDownloadFilename)</WixDownloadUrl>
43-
<WixDestinationPath>$(WixToolsDir)$(WixDownloadFilename)</WixDestinationPath>
44-
<WixDownloadSentinel>$(WixToolsDir)$(WixDownloadFilename).sentinel</WixDownloadSentinel>
4534
</PropertyGroup>
4635
</Target>
4736

@@ -206,7 +195,7 @@
206195
<!-- Set up information to pass to WiX, depending on the type of installer being created. -->
207196
<Target Name="GetWixBuildConfiguration"
208197
DependsOnTargets="
209-
AcquireWix;
198+
_AcquireWix;
210199
_GetInstallerProperties;
211200
_GenerateMsiVersionString;
212201
GetInstallerWixConfiguration;
@@ -447,29 +436,20 @@
447436
<!--
448437
Acquire NuGet.exe, if not present.
449438
-->
450-
<Target Name="_AcquireNuGetExe"
451-
DependsOnTargets="_GetAcquireNuGetExeProperties">
439+
<Target Name="_AcquireNuGetExe">
452440
<MSBuild
453-
Projects="$(AcquireNuGetExeProjectFile)"
441+
Projects="$(MSBuildThisFileDirectory)..\acquisition\acquire-nuget-exe\acquire-nuget-exe.proj"
454442
Targets="AcquireNuGetExeCore"
455443
Properties="BaseIntermediateOutputPath=$(BaseIntermediateOutputPath);
456-
RepoRoot=$(RepoRoot)" />
457-
</Target>
458-
459-
<Target Name="_GetAcquireNuGetExeProperties">
460-
<PropertyGroup>
461-
<AcquireNuGetExeProjectFile>$(MSBuildThisFileDirectory)..\acquisition\acquire-nuget-exe\acquire-nuget-exe.proj</AcquireNuGetExeProjectFile>
462-
<!-- Using 3.5.0 to workaround https://github.com/NuGet/Home/issues/5016 -->
463-
<NuGetExeDownloadUrl>https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe</NuGetExeDownloadUrl>
464-
<NuGetExeToolDir>$(BaseIntermediateOutputPath)nuget\</NuGetExeToolDir>
465-
<NuGetExeFile>$(NuGetExeToolDir)NuGet.exe</NuGetExeFile>
466-
</PropertyGroup>
444+
RepoRoot=$(RepoRoot)">
445+
<Output TaskParameter="TargetOutputs" PropertyName="NuGetExeFile" />
446+
</MSBuild>
467447
</Target>
468448

469449
<Target Name="GenerateVSInsertionNupkgCore"
470450
DependsOnTargets="
471451
_GetTargetOSArchInfo;
472-
GetAcquireWixProperties;
452+
_AcquireWix;
473453
_AcquireNuGetExe;
474454
_GetInstallerProperties;
475455
GetWixBuildConfiguration">

0 commit comments

Comments
 (0)