[英]Wix window service only copy exe file in installation folder not all dependencies
我是wix的新用戶,正在創建一個窗口服務。 我已經創建了我的服務並成功添加到了窗口服務中,但是由於錯誤,運行時它停止了。
<?xml version="1.0" encoding="UTF-8"?>
<?define Name = "New Window Service" ?>
<?define Manufacturer = "GAT" ?>
<?define UpgradeCode = "{0d4fb541-bb66-4df8-bdab-893564e191fc}" ?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
>
<Product Id="*" Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" Version="1.0.0.0" UpgradeCode="$(var.UpgradeCode)" Language="1033">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="GAT.GATAC.ServiceLayer.WindowsServiceHost.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)">
<CreateFolder />
<File Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)" Source="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe" KeyPath="yes" Vital="yes" />
<File Id="GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config"
Name="MyProduct.exe.config"
Source="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config"
Vital="yes"
KeyPath="no"
DiskId="1" />
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<util:XmlFile Id="ModifyServiceLocation" Action="setValue" ElementPath="/configuration/connectionStrings/add[\[]@name='DefaultConnection'[\]]/@connectionString" File="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config" Value="Data Source=[DB_SERVER];Initial Catalog=[DB_DATABASE];User Id=[DB_USER];Pwd=[DB_PASSWORD]"/>
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="GAT.GATAC.ServiceLayer.WindowsServiceHost"
DisplayName="$(var.Name)"
Description="A Test Service that logs dummy text on an interval to a text file."
Start="auto"
ErrorControl="normal"
/>
<ServiceControl Id="ServiceInstaller"
Stop="both"
Remove="both"
Name="GAT.GATAC.ServiceLayer.WindowsServiceHost"
Wait="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)" />
</Feature>
</Product>
</Wix>
當我在服務的安裝文件夾中看到只有exe文件時,如何在此文件夾中復制窗口服務的所有依賴關系,我的代碼如下。當我在安裝文件夾中手動復制文件時,它起作用了。我是否需要收獲
是的,您需要在wxs中包括所有文件作為要安裝的組件。
如果您有一些依賴關系,則可以自己將它們添加為文件組件。 如果有很多文件,請考慮使用熱量為您生成wxs文件,您可以將文件元素復制到wxs代碼中。 如果文件依賴關系可能經常更改,請考慮使用熱量來始終生成wx,並將其作為鏈接文件包含在主安裝程序項目中。
理想情況下,所有依賴項都應包含在GAT.GATAC.ServiceLayer.WindowsServiceHost項目的bin文件夾中,因此您只需使用$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetDir)DependencyFileName作為文件的源即可。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.