I am trying to create a wix v4 installer for a windows service which is based on .net 8.
According to the official docu it should be possible to accomplish this.
What I want to do is to get rid of the licence agreement and add two custom dialogs (just like in the docu). I have to add that I am quite new to wix but I did my best to study the topic.
From what is explained in the docu and what I found on the internet I was able to generate an installer but the installer does not include my custom dialog.
I already searched for quite some time and also found some suggestions but none of them work.
This is my Package.wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Define the variables in "$(var.*) expressions" -->
<?define Name = "Service Client" ?>
<?define Manufacturer = "Cyberdyne Systems" ?>
<?define Version = "1.0.0.4" ?>
<?define UpgradeCode = "9ED3FF33-8718-444E-B44B-69A2344B7E98" ?>
<?define CustomActionPath = "..\CustomActions\bin\Release\net48" ?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package
Name="$(Name)"
Manufacturer="$(Manufacturer)"
Version="$(Version)"
UpgradeCode="$(var.UpgradeCode)"
Compressed="yes"
Scope="perMachine">
<MediaTemplate EmbedCab="yes" />
<ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER"/>
<!-- Allow upgrades and prevent downgrades -->
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<Property Id="INSTALLFOLDER" Value="D:\test\Windows Services\Service Client" />
<StandardDirectory Id="TARGETDIR">
<Directory Id="DDrive" Name="D">
<Directory Id="Test" Name="Test">
<Directory Id="WindowsServices" Name="Windows Services">
<Directory Id="INSTALLFOLDER" Name="$(Name)" />
</Directory>
</Directory>
</Directory>
</StandardDirectory>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="ServiceExecutable" Guid="d39f02cf-db54-4067-9827-720f839458f5" Bitness="always64">
<File Id="ServiceClient.exe" Source="$(var.ServiceClient.TargetDir)publish\win-x64\ServiceClient.exe" KeyPath="true" />
<File Id="appsettings.json" Source="$(var.ServiceClient.TargetDir)publish\win-x64\appsettings.json" KeyPath="false" />
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Name="ServiceClient" DisplayName="$(Name)" Description="Service responsible for various file operations." Start="auto" ErrorControl="normal" />
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ServiceClient" Wait="true" />
</Component>
</DirectoryRef>
<Binary Id="CustomActions" SourceFile="$(var.CustomActionPath)\CustomActions.CA.dll" />
<CustomAction Id="SetCustomActionData" Property="UpdateAppSettings" Value="INSTALLFOLDER=[INSTALLFOLDER];APIURL=[APIURL];USERNAME=[USERNAME];PASSWORD=[PASSWORD]" Execute="immediate" Return="check" />
<CustomAction Id="UpdateAppSettings" BinaryRef="CustomActions" DllEntry="UpdateAppSettings" Execute="deferred" Return="check" />
<CustomAction Id="ExtractUserCredentials" BinaryRef="CustomActions" DllEntry="ExtractUserCredentials" Execute="immediate" Return="check" />
<CustomAction Id="TestAPI" BinaryRef="CustomActions" DllEntry="TestAPI" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="SetCustomActionData" After="InstallFiles" Condition="NOT Installed AND NOT PATCH" />
<Custom Action="UpdateAppSettings" After="SetCustomActionData" Condition="NOT Installed AND NOT PATCH" />
</InstallExecuteSequence>
<UI>
<UIRef Id="MyUI" />
</UI>
<Feature Id="Service" Title="ServiceClient Setup" Level="1">
<ComponentRef Id="ServiceExecutable" />
</Feature>
</Package>
</Wix>
An my UI.wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<UI Id="MyUI" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<ui:WixUI Id="WixUI_InstallDir" InstallDirectory="INSTALLFOLDER"/>
<Dialog Id="APIDlg" Width="370" Height="270" Title="!(loc.APIDlgTitle)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.NextButtonText)">
<Publish Event="NewDialog" Value="InstallDirDlg" />
</Control>
<Control Id="Prev" Type="PushButton" X="172" Y="243" Width="56" Height="17" Text="!(loc.PrevButtonText)">
<Publish Event="NewDialog" Value="VerifyReadyDlg" />
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.CancelButtonText)">
<Publish Event="EndDialog" Value="Exit" Condition="1" />
</Control>
<Control Id="APILabel" Type="Text" X="20" Y="80" Width="290" Height="15" Text="!(loc.APILabel)" />
<Control Id="APIURL" Type="Edit" X="20" Y="95" Width="290" Height="18" Property="APIURL" />
<Control Id="TestAPI" Type="PushButton" X="320" Y="95" Width="40" Height="18" Text="Test">
<Publish Event="DoAction" Value="TestAPI" />
</Control>
</Dialog>
<!-- Navigation: Insert your custom dialog into the sequence -->
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="APIDlg" Condition="NOT Installed"/>
<Publish Dialog="APIDlg" Control="Prev" Event="NewDialog" Value="InstallDirDlg" Condition="1"/>
<Publish Dialog="APIDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="1"/>
</UI>
</Fragment>
</Wix>
No matter what I do, the custom dialog wont show up. Does anybody have a hint what to change?
If I follow a very similar approach like mentioned here: Wix issue inserting a custom dialog into a built-in dialog set I get lots of errors like:
- WIX0092 Location of symbol related to previous error. ...\WixUI_InstallDir.wxs
- WIX0091 Duplicate TextStyle with identifier 'WixUI_Font_Title' found. Access modifiers (global, library, file, section) cannot prevent these conflicts. Ensure all your identifiers of a given type (Directory, File, etc.) are unique. ...\Package.wxs
- WIX0130 The primary key 'BrowseDlg/OK/SpawnDialog/InvalidDirDlg/NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"' is duplicated in table 'ControlEvent'. Please remove one of the entries or rename a part of the primary key to avoid the collision. ...Package.wxs
- and many more
<InstallUISequence>that includes a set of<Show>elements that point to the dialog box and describe their order (before/after). This doesn't address the errors you're getting, but it might explain why you're not seeing your dialogs called.