C# Wix 服务安装程序 - 未解析的符号引用
C# Wix Service installer - Unresolved reference to symbol
我使用 Viwual Studio 2017 在 C# 中创建了一个服务。
现在我正在尝试使用 Wix 创建安装程序。这不是我第一次使用 wix,但这次我无法构建我的设置。我有错误:
Unresolved reference to symbol 'Component:InstallComponents' in
section 'Product:*'.
我看到了一些关于这个的话题,但是并没有解决我的问题。
有我的 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>
我使用 Viwual Studio 2017 在 C# 中创建了一个服务。
现在我正在尝试使用 Wix 创建安装程序。这不是我第一次使用 wix,但这次我无法构建我的设置。我有错误:
Unresolved reference to symbol 'Component:InstallComponents' in section 'Product:*'.
我看到了一些关于这个的话题,但是并没有解决我的问题。
有我的 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>