WiX - 未定义的预处理器变量 '$(var.SetupProject1.TargetDir)' [英] WiX - Undefined preprocessor variable '$(var.SetupProject1.TargetDir)'

查看:30
本文介绍了WiX - 未定义的预处理器变量 '$(var.SetupProject1.TargetDir)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注

Product.wxs

ProductComponent.wxs

解决方案

只需删除第二个文件 ProductComponent.wxs 就可以了.

该博客中提到的外部工具是一个好主意,但只能通过激活您的 winform 项目而不是您当前的项目(wix 项目)来运行.

I'm following this tutorial to create a WiX installer for a VS2017 Winform app. It's just a default Winform app (nothing fancy). But when I build the WiX project (SetupProject1 shown in figure 1 below), I get the following error at first <File id=.../> tag of ProductComponent.wxs (shown below).

Question: What I may be missing here?

Note: I'm using this Wix Toolset Visual Studio 2017 Extension

Error:

Undefined preprocessor variable '$(var.SetupProject1.TargetDir)'

VS2017 Solution Explorer:

Product.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="89ae9543-fdf1-444b-9678-811483fd58bd" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="WiX_test_4_Winfrm" UpgradeCode="e69fe67b-5c28-4764-8196-a6613b840eff">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <UIRef Id="WixUI_Mondo" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"></Property>

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

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

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="SetupProject1" />
            </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="CMP_SetupProject1">
         <File Source="$(var.WIX_WinfrmTest.TargetPath)" />
             </Component> 
        </ComponentGroup>
    </Fragment>
</Wix>

ProductComponent.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ProductComponents">
            <Component Id="cmp2C5CB3BF0E009CA9CF5E03CADA38250D" Directory="INSTALLFOLDER" Guid="{C694E446-7B01-42C0-9056-4E09834809E9}">
                <File Id="fil3A244EF6571347120C494BB170DC368E" KeyPath="yes" Source="$(var.SetupProject1.TargetDir)\cab1.cab" />
            </Component>
            <Component Id="cmpB6E89A2030E867C94B57A39FE26E1181" Directory="INSTALLFOLDER" Guid="{E8E1247F-627F-420D-97E0-0ABE39A2064C}">
                <File Id="fil41A028F0E06C7EEE038806BDA5979087" KeyPath="yes" Source="$(var.SetupProject1.TargetDir)\SetupProject1.msi" />
            </Component>
            <Component Id="cmpD2FFED031AA728C90BED6090228F3AE3" Directory="INSTALLFOLDER" Guid="{660414BB-E061-4EE2-A7E2-471EA41C031F}">
                <File Id="fil3F7C931DA08579E26A8F50778E59444A" KeyPath="yes" Source="$(var.SetupProject1.TargetDir)\SetupProject1.wixpdb" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

解决方案

Just remove your second file ProductComponent.wxs should be OK.

The external tool mentioned on that blog is a good idea, but that should only be run by activating your winform project not your current project (the wix project).

这篇关于WiX - 未定义的预处理器变量 '$(var.SetupProject1.TargetDir)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆