Skip to content

Commit 3e3a4ca

Browse files
committed
feat: added icon to installer's bootstrap application
1 parent 22c9bcd commit 3e3a4ca

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

Installer/Program.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public class BootstrapperOptions : SharedOptions
119119
[Option('w', "windows-app-sdk-path", Required = true, HelpText = "Path to the Windows App Sdk package to embed")]
120120
public string WindowsAppSdkPath { get; set; }
121121

122+
[Option('t', "theme-xml-path", Required = false, HelpText = "Path to the theme .xml file to use for the installer")]
123+
public string ThemeXmlPath { get; set; }
124+
122125
public new void Validate()
123126
{
124127
base.Validate();
@@ -130,6 +133,8 @@ public class BootstrapperOptions : SharedOptions
130133
if (!SystemFile.Exists(WindowsAppSdkPath))
131134
throw new ArgumentException($"Windows App Sdk package not found at '{WindowsAppSdkPath}'",
132135
nameof(WindowsAppSdkPath));
136+
if (ThemeXmlPath != null && !SystemFile.Exists(ThemeXmlPath))
137+
throw new ArgumentException($"Theme XML file not found at '{ThemeXmlPath}'", nameof(ThemeXmlPath));
133138
}
134139
}
135140

@@ -415,6 +420,20 @@ private static int BuildBundle(BootstrapperOptions opts)
415420
bundle.Application.LicensePath = opts.LicenseFile;
416421
bundle.Application.LogoFile = opts.LogoPng;
417422

423+
if (opts.ThemeXmlPath != null)
424+
{
425+
bundle.Application.ThemeFile = opts.ThemeXmlPath;
426+
bundle.Application.Payloads =
427+
[
428+
new ExePackagePayload
429+
{
430+
Name = "icon.ico",
431+
SourceFile = opts.IconFile,
432+
Compressed = true,
433+
},
434+
];
435+
}
436+
418437
// Set the default install folder, which will eventually be passed into
419438
// the MSI.
420439
bundle.Variables =

scripts/Publish.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ $windowsAppSdkPath = Join-Path $scriptRoot "files\windows-app-sdk-$($arch).exe"
189189
--icon-file "App\coder.ico" `
190190
--msi-path $msiOutputPath `
191191
--windows-app-sdk-path $windowsAppSdkPath `
192+
--theme-xml-path "scripts\files\RtfThemeLarge.xml" `
192193
--logo-png "scripts\files\logo.png"
193194
if ($LASTEXITCODE -ne 0) { throw "Failed to build bootstrapper" }
194195

scripts/files/RtfThemeLarge.xml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- 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. -->
3+
<!-- Downloaded from https://github.com/wixtoolset/wix/blob/v5.0.2/src/ext/Bal/stdbas/Resources/RtfLargeTheme.xml -->
4+
5+
<Theme xmlns="http://wixtoolset.org/schemas/v4/thmutil">
6+
<Font Id="0" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>
7+
<Font Id="1" Height="-24" Weight="500" Foreground="windowtext">Segoe UI</Font>
8+
<Font Id="2" Height="-22" Weight="500" Foreground="graytext">Segoe UI</Font>
9+
<Font Id="3" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>
10+
11+
<Window Width="500" Height="390" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)" IconFile="icon.ico">
12+
<ImageControl X="11" Y="11" Width="64" Height="64" ImageFile="logo.png" Visible="yes"/>
13+
<Label X="80" Y="11" Width="-11" Height="64" FontId="1" Visible="yes" DisablePrefix="yes">#(loc.Title)</Label>
14+
15+
<Page Name="Help">
16+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.HelpHeader)</Label>
17+
<Label X="11" Y="112" Width="-11" Height="-35" FontId="3" DisablePrefix="yes">#(loc.HelpText)</Label>
18+
<Button Name="HelpCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
19+
<Text>#(loc.HelpCloseButton)</Text>
20+
<CloseWindowAction />
21+
</Button>
22+
</Page>
23+
<Page Name="Loading">
24+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes" Visible="no" Name="CheckingForUpdatesLabel" />
25+
</Page>
26+
<Page Name="Install">
27+
<Label X="11" Y="80" Width="-11" Height="-70" TabStop="no" FontId="2" HexStyle="800000" DisablePrefix="yes" />
28+
<Richedit Name="EulaRichedit" X="12" Y="81" Width="-12" Height="-71" TabStop="yes" FontId="0" />
29+
<Label Name="InstallVersion" X="11" Y="-41" Width="210" Height="17" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBAShowVersion">#(loc.InstallVersion)</Label>
30+
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
31+
<Button Name="InstallUpdateButton" X="11" Y="-11" Width="200" Height="23" TabStop="yes" FontId="0" EnableCondition="WixStdBAUpdateAvailable" HideWhenDisabled="yes">#(loc.UpdateButton)</Button>
32+
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" VisibleCondition="NOT WixStdBASuppressOptionsUI">
33+
<Text>#(loc.InstallOptionsButton)</Text>
34+
<ChangePageAction Page="Options" />
35+
</Button>
36+
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
37+
<Button Name="InstallCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
38+
<Text>#(loc.InstallCancelButton)</Text>
39+
<CloseWindowAction />
40+
</Button>
41+
</Page>
42+
<Page Name="Options">
43+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Label>
44+
<Label X="11" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OptionsLocationLabel)</Label>
45+
<Editbox Name="InstallFolder" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" />
46+
<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">
47+
<Text>#(loc.OptionsBrowseButton)</Text>
48+
<BrowseDirectoryAction VariableName="InstallFolder" />
49+
</Button>
50+
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
51+
<Text>#(loc.OptionsOkButton)</Text>
52+
<ChangePageAction Page="Install" />
53+
</Button>
54+
<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
55+
<Text>#(loc.OptionsCancelButton)</Text>
56+
<ChangePageAction Page="Install" Cancel="yes" />
57+
</Button>
58+
</Page>
59+
<Page Name="Progress">
60+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ProgressHeader)</Label>
61+
<Label X="11" Y="121" Width="70" Height="17" FontId="3" DisablePrefix="yes">#(loc.ProgressLabel)</Label>
62+
<Label Name="OverallProgressPackageText" X="85" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OverallProgressPackageText)</Label>
63+
<Progressbar Name="OverallCalculatedProgressbar" X="11" Y="143" Width="-11" Height="15" />
64+
<Button Name="ProgressCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ProgressCancelButton)</Button>
65+
</Page>
66+
<Page Name="Modify">
67+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ModifyHeader)</Label>
68+
<Button Name="ModifyUpdateButton" X="11" Y="-11" Width="200" Height="23" TabStop="yes" FontId="0" EnableCondition="WixStdBAUpdateAvailable" HideWhenDisabled="yes">#(loc.UpdateButton)</Button>
69+
<Button Name="RepairButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.ModifyRepairButton)</Button>
70+
<Button Name="UninstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyUninstallButton)</Button>
71+
<Button Name="ModifyCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
72+
<Text>#(loc.ModifyCancelButton)</Text>
73+
<CloseWindowAction />
74+
</Button>
75+
</Page>
76+
<Page Name="Success">
77+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">
78+
<Text>#(loc.SuccessHeader)</Text>
79+
<Text Condition="WixBundleAction = 2">#(loc.SuccessLayoutHeader)</Text>
80+
<Text Condition="WixBundleAction = 3">#(loc.SuccessUnsafeUninstallHeader)</Text>
81+
<Text Condition="WixBundleAction = 4">#(loc.SuccessUninstallHeader)</Text>
82+
<Text Condition="WixBundleAction = 5">#(loc.SuccessCacheHeader)</Text>
83+
<Text Condition="WixBundleAction = 6">#(loc.SuccessInstallHeader)</Text>
84+
<Text Condition="WixBundleAction = 7">#(loc.SuccessModifyHeader)</Text>
85+
<Text Condition="WixBundleAction = 8">#(loc.SuccessRepairHeader)</Text>
86+
</Label>
87+
<Button Name="LaunchButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessLaunchButton)</Button>
88+
<Label X="-11" Y="-51" Width="400" Height="34" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBARestartRequired">
89+
<Text>#(loc.SuccessRestartText)</Text>
90+
<Text Condition="WixBundleAction = 3">#(loc.SuccessUninstallRestartText)</Text>
91+
</Label>
92+
<Button Name="SuccessRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessRestartButton)</Button>
93+
<Button Name="SuccessCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
94+
<Text>#(loc.SuccessCloseButton)</Text>
95+
<CloseWindowAction />
96+
</Button>
97+
</Page>
98+
<Page Name="Failure">
99+
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">
100+
<Text>#(loc.FailureHeader)</Text>
101+
<Text Condition="WixBundleAction = 2">#(loc.FailureLayoutHeader)</Text>
102+
<Text Condition="WixBundleAction = 3">#(loc.FailureUnsafeUninstallHeader)</Text>
103+
<Text Condition="WixBundleAction = 4">#(loc.FailureUninstallHeader)</Text>
104+
<Text Condition="WixBundleAction = 5">#(loc.FailureCacheHeader)</Text>
105+
<Text Condition="WixBundleAction = 6">#(loc.FailureInstallHeader)</Text>
106+
<Text Condition="WixBundleAction = 7">#(loc.FailureModifyHeader)</Text>
107+
<Text Condition="WixBundleAction = 8">#(loc.FailureRepairHeader)</Text>
108+
</Label>
109+
<Hypertext Name="FailureLogFileLink" X="11" Y="121" Width="-11" Height="42" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext>
110+
<Hypertext Name="FailureMessageText" X="22" Y="163" Width="-11" Height="51" FontId="3" TabStop="yes" HideWhenDisabled="yes" />
111+
<Label Name="FailureRestartText" X="-11" Y="-51" Width="400" Height="34" FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureRestartText)</Label>
112+
<Button Name="FailureRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button>
113+
<Button Name="FailureCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
114+
<Text>#(loc.FailureCloseButton)</Text>
115+
<CloseWindowAction />
116+
</Button>
117+
</Page>
118+
</Window>
119+
</Theme>

0 commit comments

Comments
 (0)