首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wix 3安装程序:未解析的绑定-时间变量!(bind.fileVersion.Name.exe)

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

Stack Overflow用户
提问于 2018-05-30 19:45:50
回答 4查看 5.4K关注 0票数 3

我正在尝试使用来自Wix3的绑定“Wix3”。(即: 3.11.1)

出于某些原因,我得到以下错误消息:

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

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

以下是我的"Product.wxs“文件的内容:

代码语言:javascript
复制
<?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>

以下是我在VS2017社区中的解决方案的截图。

以下是错误:

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

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2018-05-30 21:03:50

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

代码语言:javascript
复制
!(bind.fileVersion.TestWix3.exe)

...

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

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

票数 8
EN

Stack Overflow用户

发布于 2018-05-30 19:50:49

语法是!(bind.fileVersion.FileId) --注意小写的f

票数 0
EN

Stack Overflow用户

发布于 2018-05-31 14:09:36

定义?定义MAINEXE=$(var.TestWix3.TargetFileName)?转换为:创建一个名为MAINEXE的变量,并将其设置为另一个变量的值。

没有定义TestWix3.TargetFileName的变量,您的第二个定义创建了一个具有名称版本的变量,并使用未定义的MAINEXE

使用像这样的定义

?定义MAINEXE=sample.exe?

?定义VERSION="!(bind.fileVersion.$(var.MAINEXE))"?编译没有问题

我省略了<< >>之前和之后?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50612355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档