[英]C# Wix Service installer - Unresolved reference to symbol
我使用Viwual Studio 2017在C#中創建了一項服務。
現在,我正在嘗試使用Wix創建安裝程序。 這不是我第一次使用wix,但是這次我無法建立我的設置。 我有錯誤:
在“產品:*”部分中未解析對符號“ Component:InstallComponents”的引用。
我看到了一些與此相關的主題,但是並不能解決我的問題。
這是我的product.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<?define compagny = "myCompagny"?>
<?define product = "Service Name"?>
<?define service = "MyService"?>
<?define version = "!(bind.FileVersion.MyService.exe)"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="$(var.product)"
Language="1033"
Version="$(var.version)"
Manufacturer="$(var.compagny)"
UpgradeCode="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Media Id="1" Cabinet="MyService.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CGYFOLDER" Name="$(var.compagny)">
<Directory Id="INSTALLFOLDER" Name="$(var.product)" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="InstallComponents">
<Component Id="InstallService" Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" Directory="INSTALLFOLDER">
<File Id="MyService.exe.config"
Name="$(var.service).exe.config"
Source="$(var.MyService.TargetDir)\$(var.service).exe.config"
Vital="yes"/>
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="$(var.service)"
DisplayName="$(var.product)"
Description=""
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
<ServiceControl Id="Service_Start" Name="MyService" Start="install" Wait="no" />
<ServiceControl Id="Service_Stop" Name="MyService" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
</ComponentGroup>
<!-- Tell WiX to install the files -->
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentRef Id="InstallComponents" />
</Feature>
</Product>
</Wix>
InstallComponents
存在於ComponentGroup
,我不明白為什么會有這個錯誤。
錯誤出在我的專題文章中。
我的InstallComponents
定義為ComponentGroup,因此要安裝它,我的功能必須像這樣:
<Feature Id="ProductFeature" Title="$(var.product)" Level="1">
<ComponentGroupRef Id="InstallComponents" />
</Feature>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.