Introducing wix-cli.msi
Fixes 8623
Rob Mensching committed
Jul 12, 2024 at 11:24 UTC
40df304afe43fcd546b5b817bcad63168ee31813
7 files changed
+195
-6
src/Directory.wixproj.targets
+2
@@ -10,7 +10,9 @@
10
<DefineConstants>
11
$(DefineConstants);
12
SetupVersion=$(PackageVersion);
13
+ SetupMajorVersion=$(SomeVerInfoMajor);
14
SetupMajorMinorVersion=$(SomeVerInfoMajor).$(SomeVerInfoMinor);
15
+ SetupMajorMinorPatchVersion=$(SomeVerInfoMajor).$(SomeVerInfoMinor).$(SomeVerInfoPatch);
16
SetupDashedMajorMinorVersion=$(SomeVerInfoMajor)-$(SomeVerInfoMinor);
17
SetupDashedPrerelease=$(PrereleaseSuffix)
18
</DefineConstants>
src/setup/MetadataTask/GenerateMetadata.cs
+67
-5
@@ -36,13 +36,22 @@ namespace WixToolset.Tasks
36
37
var section = intermediate.Sections.Single();
38
39
- if (section.Type != SectionType.Bundle)
39
+ Metadata metadata;
40
+ SourceLineNumber sourceLineNumber;
41
+
42
+ if (section.Type == SectionType.Bundle)
43
+ {
44
+ (metadata, sourceLineNumber) = this.GetBundleMetadata(section, "WixToolset.AdditionalTools");
45
+ }
46
+ else if (section.Type == SectionType.Package)
47
+ {
48
+ (metadata, sourceLineNumber) = this.GetPackageMetadata(section, "WixToolset.CommandLineTools");
49
+ }
50
+ else
51
{
52
return false;
53
}
54
44
- (var metadata, var sourceLineNumber) = this.GetBundleMetadata(section);
45
-
55
if (metadata != null)
56
{
57
this.PopulateFileInfo(metadata);
@@ -53,13 +62,13 @@ namespace WixToolset.Tasks
62
return true;
63
}
64
56
- private (Metadata, SourceLineNumber) GetBundleMetadata(IntermediateSection section)
65
+ private (Metadata, SourceLineNumber) GetBundleMetadata(IntermediateSection section, string defaultId)
66
{
67
var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single();
68
69
var metadata = new Metadata
70
{
62
- Id = "WixToolset.AdditionalTools",
71
+ Id = bundleSymbol.Id?.Id ?? defaultId,
72
Type = MetadataType.Burn,
73
Name = bundleSymbol.Name,
74
Version = bundleSymbol.Version,
@@ -76,6 +85,31 @@ namespace WixToolset.Tasks
85
return (metadata, bundleSymbol.SourceLineNumbers);
86
}
87
88
+ private (Metadata, SourceLineNumber) GetPackageMetadata(IntermediateSection section, string defaultId)
89
+ {
90
+ var packageSymbol = section.Symbols.OfType<WixPackageSymbol>().Single();
91
+ var propertySymbols = section.Symbols.OfType<PropertySymbol>().ToDictionary(p => p.Id.Id);
92
+ var platform = GetPlatformFromSummaryInformation(section.Symbols.OfType<SummaryInformationSymbol>());
93
+
94
+ var metadata = new Metadata
95
+ {
96
+ Id = packageSymbol.Id?.Id ?? defaultId,
97
+ Type = MetadataType.Msi,
98
+ Name = packageSymbol.Name,
99
+ Version = packageSymbol.Version,
100
+ Publisher = packageSymbol.Manufacturer,
101
+ Description = "Installation for " + packageSymbol.Name,
102
+ License = "MS-RL",
103
+ SupportUrl = propertySymbols["ARPHELPLINK"].Value,
104
+ ProductCode = propertySymbols["ProductCode"].Value,
105
+ UpgradeCode = propertySymbols["UpgradeCode"].Value,
106
+ AboutUrl = propertySymbols["ARPURLINFOABOUT"].Value,
107
+ Architecture = PlatformToArchitecture(platform),
108
+ };
109
+
110
+ return (metadata, packageSymbol.SourceLineNumbers);
111
+ }
112
+
113
private void PopulateFileInfo(Metadata metadata)
114
{
115
var fi = new FileInfo(this.TargetFile);
@@ -101,6 +135,34 @@ namespace WixToolset.Tasks
135
File.WriteAllText(metadataFilePath, json);
136
}
137
138
+ private static Platform GetPlatformFromSummaryInformation(IEnumerable<SummaryInformationSymbol> symbols)
139
+ {
140
+ foreach (var symbol in symbols)
141
+ {
142
+ if (symbol.PropertyId == SummaryInformationType.PlatformAndLanguage)
143
+ {
144
+ var value = symbol.Value;
145
+ var separatorIndex = value.IndexOf(';');
146
+ var platformValue = separatorIndex > 0 ? value.Substring(0, separatorIndex) : value;
147
+
148
+ switch (platformValue)
149
+ {
150
+ case "x64":
151
+ return Platform.X64;
152
+
153
+ case "Arm64":
154
+ return Platform.ARM64;
155
+
156
+ case "Intel":
157
+ default:
158
+ return Platform.X86;
159
+ }
160
+ }
161
+ }
162
+
163
+ return Platform.X86;
164
+ }
165
+
166
private static ArchitectureType PlatformToArchitecture(Platform platform)
167
{
168
switch (platform)
src/setup/setup.cmd
+2
@@ -35,7 +35,9 @@ msbuild -Restore setup.sln -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl
35
36
:clean
37
@rd /s/q "..\..\build\setup" 2> nul
38
+@del "..\..\build\artifacts\wix-cli-x64.*" 2> nul
39
@del "..\..\build\artifacts\WixAdditionalTools.*" 2> nul
40
+@del "..\..\build\logs\pdbs\%_C%\wix-cli-x64.*" 2> nul
41
@del "..\..\build\logs\pdbs\%_C%\WixAdditionalTools.*" 2> nul
42
@exit /b
43
src/setup/setup.sln
+6
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32630.192
5
MinimumVisualStudioVersion = 10.0.40219.1
6
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "ThmViewerPackage", "ThmViewerPackage\ThmViewerPackage.wixproj", "{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}"
7
EndProject
8
+Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "wix-cli", "wix-cli\wix-cli.wixproj", "{69C043AF-F9D4-427D-A954-D0362DF25E6E}"
9
+EndProject
10
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "WixAdditionalTools", "WixAdditionalTools\WixAdditionalTools.wixproj", "{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}"
11
EndProject
12
Global
@@ -17,6 +19,10 @@ Global
19
{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
20
{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
21
{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Release|Any CPU.Build.0 = Release|Any CPU
22
+ {69C043AF-F9D4-427D-A954-D0362DF25E6E}.Debug|Any CPU.ActiveCfg = Debug|x64
23
+ {69C043AF-F9D4-427D-A954-D0362DF25E6E}.Debug|Any CPU.Build.0 = Debug|x64
24
+ {69C043AF-F9D4-427D-A954-D0362DF25E6E}.Release|Any CPU.ActiveCfg = Release|x64
25
+ {69C043AF-F9D4-427D-A954-D0362DF25E6E}.Release|Any CPU.Build.0 = Release|x64
26
{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27
{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
28
{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
src/setup/wix-cli/Package.wxs
new
+81
@@ -0,0 +1,81 @@
1
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Package Name="WiX Toolset Command-Line Tools" Manufacturer="WiX Toolset" Version="!(bind.fileVersion.WixExe)" UpgradeCode="2e85dc76-769f-46d2-82a7-46cb3a0c9d50">
4
+ <MediaTemplate EmbedCab="yes" />
5
+
6
+ <ComponentGroupRef Id="BinaryFiles" />
7
+ <ComponentGroupRef Id="ExtensionFiles" />
8
+
9
+ <Property Id="ARPURLINFOABOUT" Value="https://wixtoolset.org/" />
10
+ <Property Id="ARPHELPLINK" Value="https://wixtoolset.org/docs/gethelp/" />
11
+ <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLFOLDER]" After="CostFinalize" />
12
+ </Package>
13
+
14
+ <Fragment>
15
+ <ComponentGroup Id="BinaryFiles" Directory="BinFolder">
16
+ <Component>
17
+ <File Id="WixExe" Source="!(bindpath.Files)\wix.exe" />
18
+ <File Source="!(bindpath.Files)\wix.exe.config" />
19
+
20
+ <Environment Name="PATH" Value="[BinFolder]" Action="set" Part ="last" System="yes" />
21
+ <Environment Name="WIX$(SetupMajorVersion)" Value="[BinFolder]" Action="set" System="yes" />
22
+ </Component>
23
+
24
+ <Files Include="!(bindpath.Files)\**">
25
+ <Exclude Files="!(bindpath.Files)\wix.exe*" />
26
+ <Exclude Files="!(bindpath.Files)\**\*.xml" />
27
+ <Exclude Files="!(bindpath.Files)\**\*.targets" />
28
+ </Files>
29
+
30
+ <Files Include="!(bindpath.Heat_x64)\**" Subdirectory="x64" />
31
+ <Files Include="!(bindpath.Heat_x86)\**" Subdirectory="x86" />
32
+ </ComponentGroup>
33
+ </Fragment>
34
+
35
+ <Fragment>
36
+ <ComponentGroup Id="ExtensionFiles" Directory="ExtensionFolder">
37
+ <File Subdirectory="WixToolset.BootstrapperApplications.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
38
+ Source="WixToolset.BootstrapperApplications.wixext.dll" />
39
+ <File Subdirectory="WixToolset.ComPlus.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
40
+ Source="WixToolset.ComPlus.wixext.dll" />
41
+ <File Subdirectory="WixToolset.Dependency.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
42
+ Source="WixToolset.Dependency.wixext.dll" />
43
+ <File Subdirectory="WixToolset.DirectX.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
44
+ Source="WixToolset.DirectX.wixext.dll" />
45
+ <File Subdirectory="WixToolset.Firewall.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
46
+ Source="WixToolset.Firewall.wixext.dll" />
47
+ <File Subdirectory="WixToolset.Http.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
48
+ Source="WixToolset.Http.wixext.dll" />
49
+ <File Subdirectory="WixToolset.Iis.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
50
+ Source="WixToolset.Iis.wixext.dll" />
51
+ <File Subdirectory="WixToolset.Msmq.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
52
+ Source="WixToolset.Msmq.wixext.dll" />
53
+ <File Subdirectory="WixToolset.NetFx.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
54
+ Source="WixToolset.NetFx.wixext.dll" />
55
+ <File Subdirectory="WixToolset.PowerShell.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
56
+ Source="WixToolset.PowerShell.wixext.dll" />
57
+ <File Subdirectory="WixToolset.Sql.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
58
+ Source="WixToolset.Sql.wixext.dll" />
59
+ <File Subdirectory="WixToolset.UI.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
60
+ Source="WixToolset.UI.wixext.dll" />
61
+ <File Subdirectory="WixToolset.Util.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
62
+ Source="WixToolset.Util.wixext.dll" />
63
+ <File Subdirectory="WixToolset.VisualStudio.wixext\$(SetupMajorMinorPatchVersion)\wixext$(SetupMajorVersion)"
64
+ Source="WixToolset.VisualStudio.wixext.dll" />
65
+ </ComponentGroup>
66
+ </Fragment>
67
+
68
+ <Fragment>
69
+ <StandardDirectory Id="ProgramFiles64Folder">
70
+ <Directory Id="INSTALLFOLDER" Name="WiX Toolset v$(SetupMajorMinorVersion)">
71
+ <Directory Id="BinFolder" Name="bin" />
72
+ </Directory>
73
+ </StandardDirectory>
74
+ </Fragment>
75
+
76
+ <Fragment>
77
+ <StandardDirectory Id="CommonFiles64Folder">
78
+ <Directory Id="ExtensionFolder" Name="WixToolset\extensions" />
79
+ </StandardDirectory>
80
+ </Fragment>
81
+</Wix>
src/setup/wix-cli/wix-cli.wixproj
new
+36
@@ -0,0 +1,36 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project Sdk="WixToolset.Sdk">
3
+ <PropertyGroup>
4
+ <Platform>x64</Platform>
5
+ <OutputName>wix-cli-$(Platform)</OutputName>
6
+ <OutputPath>$(PackageOutputPath)</OutputPath>
7
+ <SignOutput>true</SignOutput>
8
+ </PropertyGroup>
9
+
10
+ <ItemGroup>
11
+ <BindPath BindName="Files" Include="$(RootBuildFolder)wix\$(Configuration)\net472\win-$(Platform)" />
12
+ <BindPath BindName="Heat_x64" Include="$(RootBuildFolder)tools\$(Configuration)\net472\win-x64\" />
13
+ <BindPath BindName="Heat_x86" Include="$(RootBuildFolder)tools\$(Configuration)\net472\win-x86\" />
14
+
15
+ <BindPath Include="$(RootBuildFolder)Bal.wixext\$(Configuration)\netstandard2.0\" />
16
+ <BindPath Include="$(RootBuildFolder)ComPlus.wixext\$(Configuration)\netstandard2.0\" />
17
+ <BindPath Include="$(RootBuildFolder)Dependency.wixext\$(Configuration)\netstandard2.0\" />
18
+ <BindPath Include="$(RootBuildFolder)DirectX.wixext\$(Configuration)\netstandard2.0\" />
19
+ <BindPath Include="$(RootBuildFolder)Firewall.wixext\$(Configuration)\netstandard2.0\" />
20
+ <BindPath Include="$(RootBuildFolder)Http.wixext\$(Configuration)\netstandard2.0\" />
21
+ <BindPath Include="$(RootBuildFolder)Iis.wixext\$(Configuration)\netstandard2.0\" />
22
+ <BindPath Include="$(RootBuildFolder)Msmq.wixext\$(Configuration)\netstandard2.0\" />
23
+ <BindPath Include="$(RootBuildFolder)NetFx.wixext\$(Configuration)\netstandard2.0\" />
24
+ <BindPath Include="$(RootBuildFolder)PowerShell.wixext\$(Configuration)\netstandard2.0\" />
25
+ <BindPath Include="$(RootBuildFolder)Sql.wixext\$(Configuration)\netstandard2.0\" />
26
+ <BindPath Include="$(RootBuildFolder)UI.wixext\$(Configuration)\netstandard2.0\" />
27
+ <BindPath Include="$(RootBuildFolder)Util.wixext\$(Configuration)\netstandard2.0\" />
28
+ <BindPath Include="$(RootBuildFolder)VisualStudio.wixext\$(Configuration)\netstandard2.0\" />
29
+ </ItemGroup>
30
+
31
+ <UsingTask TaskName="GenerateMetadata" AssemblyFile="$(BaseOutputPath)$(Configuration)\net472\MetadataTask.dll" />
32
+
33
+ <Target Name="GenerateMetadata" AfterTargets="AfterBuild">
34
+ <GenerateMetadata TargetFile="$(TargetPath)" WixpdbFile="$(TargetPdbPath)" />
35
+ </Target>
36
+</Project>
src/wix/WixToolset.Core/CommandLine/CommandLine.cs
+1
-1
@@ -56,7 +56,7 @@ namespace WixToolset.Core.CommandLine
56
if (!this.SuppressLogo && command?.ShowLogo == true)
57
{
58
var branding = this.ServiceProvider.GetService<IWixBranding>();
59
- Console.WriteLine(branding.ReplacePlaceholders("[AssemblyProduct] [AssemblyDescription] version [ProductVersion]"));
59
+ Console.WriteLine(branding.ReplacePlaceholders("[AssemblyProduct] version [ProductVersion]"));
60
Console.WriteLine(branding.ReplacePlaceholders("[AssemblyCopyright]"));
61
Console.WriteLine();
62
}