Установщик wix 3: Неразрешенная переменная времени привязки! (bind.fileVersion.Name.exe) - PullRequest
0 голосов
/ 30 мая 2018

Я пытаюсь использовать привязку "bind.fileVersion" из Wix3.(т.е. 3.11.1)

По какой-то причине я получаю следующее сообщение об ошибке:

Неразрешенная переменная времени привязки! (bind.fileVersion.TestWix3.exe).

Моя цель - заполнить строку «Идентификатор продукта».Особенно информация о версии = "$ (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>

Вот скриншот моего решения в VS2017сообщество.enter image description here

Вот ошибка: enter image description here

Есть идеи, почему не работает привязка (bind.fileVersion)?

Ответы [ 3 ]

0 голосов
/ 31 мая 2018

Часть FileId переменной bind представляет <File Id="..."> Id.т.е.:

!(bind.fileVersion.TestWix3.exe)

...

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

В настоящее время ваши определения компонентов и файлов TODO, поэтому вы не можете использовать этот тип переменной связывания.

0 голосов
/ 31 мая 2018

Ваше определение? Define MAINEXE = $ (var.TestWix3.TargetFileName)?переводится как: создать переменную с именем MAINEXE и установить для нее значение другой переменной.

Переменная не определена TestWix3.TargetFileName Ваше второе определение создало переменную с именем VERSION и использует неопределенный MAINEXE

вместо этого используется определение
? Define MAINEXE = sample.exe?? define VERSION = "! (bind.fileVersion. $ (var.MAINEXE))" "без проблем компилируется

Я пропустил << >> до и после?

0 голосов
/ 30 мая 2018

Синтаксис !(bind.fileVersion.FileId) - обратите внимание на нижний регистр f.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...