wix 3 安装程序:未解析的绑定时变量!(bind.fileVersion.Name.exe)

2024-05-14

我正在尝试使用 Wix3 中的绑定“bind.fileVersion”。 (即:3.11.1)

由于某些原因,我收到以下错误消息:

未解析的绑定时变量!(bind.fileVersion.TestWix3.exe)。

我的目标是填写“产品 ID”行。特别是 Version="$(var.VERSION)" 信息。

这是我的“Product.wxs”文件的内容:

<?xml version="1.0" encoding="UTF-8"?>

<?define LongName = "Test wix 3" ?>    
<?define Manufacturer = "Test" ?>
<?define ProductUpgradeCode = "5fc3e435-fad3-4c1d-997f-3483beffe0a4" ?>

<?define MAINEXE=$(var.TestWix3.TargetFileName)?>
<?define VERSION="!(bind.fileVersion.$(var.MAINEXE))"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*" Name="$(var.LongName)" Language="1036" Codepage="1252" Version="$(var.VERSION)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.ProductUpgradeCode)">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="Wix3Installer" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="Wix3Installer" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
                <!-- TODO: Insert files, registry keys, and other resources here. -->
            <!-- </Component> -->     
        </ComponentGroup>
    </Fragment>
</Wix>

Here is the screenshot of my solution in VS2017 Community. enter image description here

Here is the error: enter image description here

知道为什么 (bind.fileVersion) 的绑定不起作用吗?


绑定变量的 FileId 部分代表<File Id="..."> Id. ie:

!(bind.fileVersion.TestWix3.exe)

...

<Component Id="MainProduct">
    <File Id="TestWix3.exe" KeyPath="yes" Source="$(var.TestWix3.TargetPath)"/>
    ... other stuff maybe ...
</Component>

目前您的组件和文件定义是TODO所以你还不能使用这种类型的绑定变量。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

wix 3 安装程序:未解析的绑定时变量!(bind.fileVersion.Name.exe) 的相关文章

随机推荐