我有一个Windows服务项目,其中包含一个WCF(自我主机)服务(几个dll文件和一个app.config),这将与Wix一起安装。
我添加了对Wix安装程序包的引用,这就是Product.wxs文件的样子:
<?xml version="1.0" encoding="UTF-8"?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="MyAppINSTALLDIR" Name="MyApp 5Service">
<Component Id="SampleServiceComponent" DiskId="1" Guid="6f51c0f3-776c-4aec-a200-1f199352c6c3" Win64="yes">
<File Id="MyApp.WindowsService.exe" Name="MyApp.WindowsService.exe" Source="$(var.MyApp .WindowsService.TargetDir)\MyApp.WindowsService.exe"/>
<ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp .WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlMyAppService" Name="MyApp5.WindowsService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
</Directory>
</Directory>
<Property Id="WIXUI_INSTALLDIR" Value="MyAppINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="Wix_MyApp.WindowsService" Level="1">
<ComponentRef Id="SampleServiceComponent" />
</Feature>
<Media Id="1" Cabinet="SampleServiceComponent.cab" EmbedCab="yes" />
</Product>
这项工作到了一定程度,现在我有了一些问题:
编辑1:
要从输出中获取所有文件,我将其更改为此但不起作用? :
<File Id="MyApp.WindowsService.Output"
Name="$(var.MyApp.WindowsService.TargetFileName)"
Source="$(var.MyApp.WindowsService.TargetPath)"
KeyPath="yes" />
<ServiceInstall Id="InstallMyAppService" DisplayName="MyAppService" Name="MyApp.WindowsService.exe" Description="MyApp 5 Service - För effektivare och enklare operationsplanering" Account="NetworkService" ErrorControl="normal" Start="demand" Type="ownProcess" Vital="yes" />
<ServiceControl Id="ControlMyAppService" Name="MyApp.WindowsService.exe" Stop="uninstall" Remove="uninstall" />
</Component>
答案 0 :(得分:1)
<Component>
并将<File>
放入其中。您还需要将<ComponentRef>
放入<Feature>
。<XmlConfig>
或<XmlFile>
元素修改app.config。