WiX中运行灯光时无效的DefaultDir [英] Invalid DefaultDir when running light in WiX

查看:43
本文介绍了WiX中运行灯光时无效的DefaultDir的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想做一个安装程序,将一些文件移到程序文件"中,设置一个开始菜单链接,并出现在要卸载的添加/删除程序中.目前,我很乐意在开始菜单链接上微调,因为这似乎相对简单

I simply want to do an installer that will move some files into Program Files, set up a start menu link, and appear in the add/remove program to be uninstalled. For the time being I'm happy to punt on the start-menu link as that seems relatively straight forward

需要注意的是,我特别希望它可以通过脚本构建而无需任何全局安装.这意味着没有Visual Studio扩展,也没有WiX工具包的任何全局安装.

The caveat is that I specifically want this to be build-able from a script without any sort of global installs. That means no Visual Studio extension nor any global installation of the WiX toolkit.

我能够找到 nuget上的WiX ,这似乎可以随附了所有正确的可执行文件.所以我想用这些.我为 candle light heat 设置了别名,以从 tools/目录中绘制.

I was able to find WiX on nuget which seems to come with all the correct executables packaged. So I would like to use these. I set up aliases for candle, light, and heat to draw from the tools/ directory.

首先,我创建一个非常简单的文件结构,将该文件结构移入Program Files/Foo

To start with, I create a very simple file structure that I want moved into Program Files/Foo

/temp/SourceDir/
  |- bar.txt
  |- one.txt
  |- afolder/
     |- baz.txt

我还使用了WixSample项目和

I also use a WixSample project and some recommendations to create the following /temp/foo.wxs:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    <!-- Use * to generate product ID on every build -->
    <Product Id="*" Language="1033" Manufacturer="gim" Name="Foo Sample" UpgradeCode="1750d746-841f-4a27-a0ba-661b093dac23" Version="1.0.0.0">
        <Package Comments="comments!" Compressed="yes" Description="Attempting to learn Wix" InstallScope="perMachine" Manufacturer="gim"/>
        <MediaTemplate EmbedCab="yes"/>
        <!--Directory structure-->
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="DYNAMIC" Name="Dynamic"/>
            </Directory>
        </Directory>
        <!--Features-->
        <Feature Id="AllOfTheFiles">
            <ComponentGroupRef Id="CMPG_AllOfTheFiles"/>
        </Feature>
    </Product>
</Wix>

然后我跑

temp> heat dir W:\temp\SourceDir\ -cg CMPG_AllOfTheFiles -ke -dr DYNAMIC -gg -sfrag -o .\Dynamic.wxs

哪个生成 Dynamic.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
    <Fragment>
        <DirectoryRef Id="DYNAMIC">
            <Directory Id="dirGQx5YQf5IXUdDl9BwSUIwBDODsQ" Name="SourceDir">
                <Component Id="cmpGDFXrG8sOAaKgy928OXqQ2tfoYI" Guid="{19459DB2-B1C7-4981-A0B9-F1CA0027B458}">
                    <File Id="fil9Q22BRrI_M6KyGIXyzknyYKsXYM" KeyPath="yes" Source="SourceDir\bar.txt" />
                </Component>
                <Component Id="cmpiuJCUGMxrseFgAzuyEWugfL6co0" Guid="{C09CEC2D-675C-438A-815D-E97D80B46579}">
                    <File Id="filJdeJM1_v6rytDwKRYjkJ6S4Ukos" KeyPath="yes" Source="SourceDir\one.txt" />
                </Component>
                <Directory Id="dir1V3jm.snhkr1aYM.1IgU9rhSuSM" Name="afolder">
                    <Component Id="cmpnBgBnytwthO6y_QeTGG7n0P_cSw" Guid="{4AAC9123-F1FE-4DFF-B7EB-1D0A7053ECF9}">
                        <File Id="filDNjPHE_Pp2VbCtvIxLyegx_2prU" KeyPath="yes" Source="SourceDir\afolder\baz.txt" />
                    </Component>
                </Directory>
            </Directory>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="CMPG_AllOfTheFiles">
            <ComponentRef Id="cmpGDFXrG8sOAaKgy928OXqQ2tfoYI" />
            <ComponentRef Id="cmpiuJCUGMxrseFgAzuyEWugfL6co0" />
            <ComponentRef Id="cmpnBgBnytwthO6y_QeTGG7n0P_cSw" />
        </ComponentGroup>
    </Fragment>
</Wix>

然后我跑

temp> candle .\foo.wxs
temp> candle .\Dynamic.wxs

哪个会为每个对象生成一个wixobj.

Which generates a wixobj for each.

最后我尝试点这些.

temp> light .\foo.wixobj .\Dynamic.wixobj -o .\foo.msi -nologo
W:\temp\Dynamic.wxs(5) : error LGHT0204 : ICE03: Invalid DefaultDir string; Table: Directory, Column: DefaultDir, Key(s): dirGQx5YQf5IXUdDl9BwSUIwBDODsQ

在这一点上,我很沮丧.我不知道此错误是什么意思,也不知道如何解决-为什么该目录引起了问题?

At this point I'm stumped. I have no idea what this error means nor how to fix it - why is that directory causing issue?

推荐答案

SourceDir是我认为的msi表中目录的保留名称.它引用正在运行的msi文件所在的目录.因此,当您尝试为ID为"dirGQx5YQf5IXUdDl9BwSUIwBDODsQ"的目录创建名称为"SourceDir"的另一个目录时,light会抱怨

SourceDir is a reserved name for a directory in the msi table I believe. It references the dir where the msi file that is being run is located. So light complains when you are trying to create another directory with name "SourceDir" for the dir with id "dirGQx5YQf5IXUdDl9BwSUIwBDODsQ"

尝试将W:\ temp \ SourceDir重命名为其他内容

Try renaming W:\temp\SourceDir to something else

这篇关于WiX中运行灯光时无效的DefaultDir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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