155 lines
6.6 KiB
XML
155 lines
6.6 KiB
XML
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui" xmlns:powershell="http://schemas.gardiner.net.au/PowerShellWixExtensionSchema">
|
|
|
|
<!--Definisco nome company/prodotto...-->
|
|
<?define Manufacturer="EgalWare"?>
|
|
<?define ProductName="Maat.Runner" ?>
|
|
|
|
<Package Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)" ProductCode="*" UpgradeCode="d3f6a5c7-e29f-4915-8ae2-5302c8dfea86" Version="!(bind.FileVersion.MaatRunner)" >
|
|
|
|
<!--Licenza d'uso (EULA)-->
|
|
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\License.rtf" />
|
|
|
|
<!--Messaggio upgrade-->
|
|
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
|
|
|
|
<!--Unico file senza cab esterni-->
|
|
<MediaTemplate EmbedCab="yes" />
|
|
|
|
|
|
<!--Info registro-->
|
|
<Property Id="APPLICATIONFOLDER">
|
|
<RegistrySearch Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
|
|
</Property>
|
|
<UI Id="UI">
|
|
<!--Aggiunto UI x finestra di dialogo x InstallDir-->
|
|
<ui:WixUI Id="WixUI_InstallDir" InstallDirectory="InstallPath" />
|
|
</UI>
|
|
|
|
<!--Componenti sw da installare-->
|
|
<Feature Id="Main" Title="MaatRunner" Level="1">
|
|
<ComponentGroupRef Id="MaatRunner" />
|
|
<ComponentGroupRef Id="ExtComp" />
|
|
<ComponentGroupRef Id="AppSettings" />
|
|
<ComponentGroupRef Id="ConfSettings" />
|
|
<ComponentGroupRef Id="Log" />
|
|
</Feature>
|
|
|
|
<!--alias powershell-->
|
|
<Property Id="POWERSHELLEXE">
|
|
<RegistrySearch Id="POWERSHELLEXE"
|
|
Type="raw"
|
|
Root="HKLM"
|
|
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
|
|
Name="Path" />
|
|
</Property>
|
|
|
|
<SetProperty Id="RunPSscript"
|
|
After="InstallFiles"
|
|
Sequence="execute"
|
|
Value=""[POWERSHELLEXE]" -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#ServiceAdd.ps1]' ; exit $$($Error.Count)"" />
|
|
<CustomAction Id="RunPSscript"
|
|
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
|
DllEntry="WixQuietExec"
|
|
Execute="deferred"
|
|
Return="check"
|
|
Impersonate="no" />
|
|
|
|
<SetProperty Id="RunPSscriptUninstall"
|
|
Before="RemoveFiles"
|
|
Sequence="execute"
|
|
Value=""[POWERSHELLEXE]" -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#ServiceRemove.ps1]' ; exit $$($Error.Count)"" />
|
|
<CustomAction Id="RunPSscriptUninstall"
|
|
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
|
DllEntry="WixQuietExec"
|
|
Execute="deferred"
|
|
Return="check"
|
|
Impersonate="no" />
|
|
|
|
<!--Sequenza install: prima rimuove (se ci fosse) poi reinstalla/avvia-->
|
|
<InstallExecuteSequence>
|
|
<Custom Action="RunPSscriptUninstall" Before="RemoveFiles" Condition="Installed OR REMOVE"></Custom>
|
|
<Custom Action="RunPSscript" After="InstallFiles" Condition="NOT REMOVE"></Custom>
|
|
</InstallExecuteSequence>
|
|
|
|
<!--per dettaglio vedere qui: https://github.com/kurtanr/WiXInstallerExamples/tree/main/04_PowerShellPreconditionCustomAction-->
|
|
|
|
</Package>
|
|
|
|
<!--Folders setup-->
|
|
<Fragment>
|
|
<StandardDirectory Id="ProgramFiles6432Folder">
|
|
<Directory Id="CompanyFolder" Name="!(bind.Property.Manufacturer)">
|
|
<Directory Id="InstallPath" Name="!(bind.Property.ProductName)">
|
|
<Directory Id="ConfPath" Name="conf" />
|
|
<Directory Id="LogPath" Name="logs" />
|
|
</Directory>
|
|
</Directory>
|
|
</StandardDirectory>
|
|
</Fragment>
|
|
|
|
<!--Main App-->
|
|
<Fragment>
|
|
<ComponentGroup Id="MaatRunner" Directory="InstallPath">
|
|
<Component>
|
|
<File Id="MaatRunner" Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\Maat.Runner.exe" />
|
|
<RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
</Fragment>
|
|
|
|
<!--Ulteriori Componenti in root (nssm, SqlClient...) + ps1 script x install come servizio)-->
|
|
<Fragment>
|
|
<ComponentGroup Id="ExtComp" Directory="InstallPath">
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\nssm.exe" />
|
|
</Component>
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\Microsoft.Data.SqlClient.SNI.dll" />
|
|
</Component>
|
|
<Component>
|
|
<File Id="ServiceAdd.ps1" Source="$(var.ProjectDir)\ServiceAdd.ps1" />
|
|
</Component>
|
|
<Component>
|
|
<File Id="ServiceRemove.ps1" Source="$(var.ProjectDir)\ServiceRemove.ps1" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
</Fragment>
|
|
|
|
<!--Appsettings -->
|
|
<Fragment>
|
|
<ComponentGroup Id="AppSettings" Directory="InstallPath">
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\appsettings.json" />
|
|
</Component>
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\NLog.config" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
</Fragment>
|
|
|
|
<!--conf avvio -->
|
|
<Fragment>
|
|
<ComponentGroup Id="ConfSettings" Directory="ConfPath">
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\conf\JobConfig-demo.json" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
</Fragment>
|
|
|
|
<!--File di Logging servizio-->
|
|
<Fragment>
|
|
<ComponentGroup Id="Log" Directory="LogPath">
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\logs\stderr.log" />
|
|
</Component>
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\logs\stdin.log" />
|
|
</Component>
|
|
<Component>
|
|
<File Source="..\Maat.Runner\bin\$(Configuration)\net6.0\publish\win-x64\logs\stdout.log" />
|
|
</Component>
|
|
</ComponentGroup>
|
|
</Fragment>
|
|
|
|
</Wix>
|