aboutsummaryrefslogtreecommitdiff
path: root/src/setup
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-07-12 11:24:37 -0700
committerRob Mensching <rob@firegiant.com>2024-07-12 14:37:05 -0700
commit40df304afe43fcd546b5b817bcad63168ee31813 (patch)
tree0bfa8b9b7f2b340b5c7d69632af15f385996f988 /src/setup
parent24d9e661a9613b3a52c37d00e4e44171b9afd998 (diff)
downloadwix-40df304afe43fcd546b5b817bcad63168ee31813.tar.gz
wix-40df304afe43fcd546b5b817bcad63168ee31813.tar.bz2
wix-40df304afe43fcd546b5b817bcad63168ee31813.zip
Introducing wix-cli.msi
Fixes 8623
Diffstat (limited to 'src/setup')
-rw-r--r--src/setup/MetadataTask/GenerateMetadata.cs72
-rw-r--r--src/setup/setup.cmd2
-rw-r--r--src/setup/setup.sln6
-rw-r--r--src/setup/wix-cli/Package.wxs81
-rw-r--r--src/setup/wix-cli/wix-cli.wixproj36
5 files changed, 192 insertions, 5 deletions
diff --git a/src/setup/MetadataTask/GenerateMetadata.cs b/src/setup/MetadataTask/GenerateMetadata.cs
index 65e6f7a4..645b7750 100644
--- a/src/setup/MetadataTask/GenerateMetadata.cs
+++ b/src/setup/MetadataTask/GenerateMetadata.cs
@@ -36,13 +36,22 @@ namespace WixToolset.Tasks
36 36
37 var section = intermediate.Sections.Single(); 37 var section = intermediate.Sections.Single();
38 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
40 { 51 {
41 return false; 52 return false;
42 } 53 }
43 54
44 (var metadata, var sourceLineNumber) = this.GetBundleMetadata(section);
45
46 if (metadata != null) 55 if (metadata != null)
47 { 56 {
48 this.PopulateFileInfo(metadata); 57 this.PopulateFileInfo(metadata);
@@ -53,13 +62,13 @@ namespace WixToolset.Tasks
53 return true; 62 return true;
54 } 63 }
55 64
56 private (Metadata, SourceLineNumber) GetBundleMetadata(IntermediateSection section) 65 private (Metadata, SourceLineNumber) GetBundleMetadata(IntermediateSection section, string defaultId)
57 { 66 {
58 var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single(); 67 var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single();
59 68
60 var metadata = new Metadata 69 var metadata = new Metadata
61 { 70 {
62 Id = "WixToolset.AdditionalTools", 71 Id = bundleSymbol.Id?.Id ?? defaultId,
63 Type = MetadataType.Burn, 72 Type = MetadataType.Burn,
64 Name = bundleSymbol.Name, 73 Name = bundleSymbol.Name,
65 Version = bundleSymbol.Version, 74 Version = bundleSymbol.Version,
@@ -76,6 +85,31 @@ namespace WixToolset.Tasks
76 return (metadata, bundleSymbol.SourceLineNumbers); 85 return (metadata, bundleSymbol.SourceLineNumbers);
77 } 86 }
78 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
79 private void PopulateFileInfo(Metadata metadata) 113 private void PopulateFileInfo(Metadata metadata)
80 { 114 {
81 var fi = new FileInfo(this.TargetFile); 115 var fi = new FileInfo(this.TargetFile);
@@ -101,6 +135,34 @@ namespace WixToolset.Tasks
101 File.WriteAllText(metadataFilePath, json); 135 File.WriteAllText(metadataFilePath, json);
102 } 136 }
103 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
104 private static ArchitectureType PlatformToArchitecture(Platform platform) 166 private static ArchitectureType PlatformToArchitecture(Platform platform)
105 { 167 {
106 switch (platform) 168 switch (platform)
diff --git a/src/setup/setup.cmd b/src/setup/setup.cmd
index 2bd82ebd..2b44b8db 100644
--- a/src/setup/setup.cmd
+++ b/src/setup/setup.cmd
@@ -35,7 +35,9 @@ msbuild -Restore setup.sln -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl
35 35
36:clean 36:clean
37@rd /s/q "..\..\build\setup" 2> nul 37@rd /s/q "..\..\build\setup" 2> nul
38@del "..\..\build\artifacts\wix-cli-x64.*" 2> nul
38@del "..\..\build\artifacts\WixAdditionalTools.*" 2> nul 39@del "..\..\build\artifacts\WixAdditionalTools.*" 2> nul
40@del "..\..\build\logs\pdbs\%_C%\wix-cli-x64.*" 2> nul
39@del "..\..\build\logs\pdbs\%_C%\WixAdditionalTools.*" 2> nul 41@del "..\..\build\logs\pdbs\%_C%\WixAdditionalTools.*" 2> nul
40@exit /b 42@exit /b
41 43
diff --git a/src/setup/setup.sln b/src/setup/setup.sln
index 1f3c0cd5..3f6b1b43 100644
--- a/src/setup/setup.sln
+++ b/src/setup/setup.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32630.192
5MinimumVisualStudioVersion = 10.0.40219.1 5MinimumVisualStudioVersion = 10.0.40219.1
6Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "ThmViewerPackage", "ThmViewerPackage\ThmViewerPackage.wixproj", "{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}" 6Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "ThmViewerPackage", "ThmViewerPackage\ThmViewerPackage.wixproj", "{F8C12838-DEC5-4CA5-97A8-DFE2247564C5}"
7EndProject 7EndProject
8Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "wix-cli", "wix-cli\wix-cli.wixproj", "{69C043AF-F9D4-427D-A954-D0362DF25E6E}"
9EndProject
8Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "WixAdditionalTools", "WixAdditionalTools\WixAdditionalTools.wixproj", "{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}" 10Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "WixAdditionalTools", "WixAdditionalTools\WixAdditionalTools.wixproj", "{59FF3AD3-339A-4048-9F0B-504EE74BC4AF}"
9EndProject 11EndProject
10Global 12Global
@@ -17,6 +19,10 @@ Global
17 {F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 {F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 {F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 {F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 {F8C12838-DEC5-4CA5-97A8-DFE2247564C5}.Release|Any CPU.Build.0 = 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
20 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 {59FF3AD3-339A-4048-9F0B-504EE74BC4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/src/setup/wix-cli/Package.wxs b/src/setup/wix-cli/Package.wxs
new file mode 100644
index 00000000..9c193130
--- /dev/null
+++ b/src/setup/wix-cli/Package.wxs
@@ -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>
diff --git a/src/setup/wix-cli/wix-cli.wixproj b/src/setup/wix-cli/wix-cli.wixproj
new file mode 100644
index 00000000..35457460
--- /dev/null
+++ b/src/setup/wix-cli/wix-cli.wixproj
@@ -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>