WIX 错误,文档元素名称为“Wix”;无效

发布于 2024-11-08 00:23:57 字数 1105 浏览 3 评论 0原文

我有多个由 heat.exe 生成的 wxs 文件。每个文件都有一个根元素 Wix、两个子 Fragment,每个 Fragment 元素分别有一个 DirectoryRef 和 ComponentGroup 元素。示例如下:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="ANEXMCM">
            <Component Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" Guid="2924A2A0-D7A2-407E-B9B8-B40AAE1204ED">
                <File Id="filABF39DC4BC6ED4474A2C2DB1C1681980" KeyPath="yes" Source="SourceDir\content.txt" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ANEXMCM_CID">
            <ComponentRef Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" />
        </ComponentGroup>
    </Fragment>
</Wix>

我将这些文件包含到主 WIX 文件中,如下所示: 。当我尝试构建项目时(我尝试了 Visual Studio 和 SharpDevelop,甚至尝试了命令行),收到的错误是“文档元素名称‘Wix’无效。Windows Installer XML 包含文件必须使用‘ Include' 作为文档元素名称 (CNDL0048) - C:\WorkingDir\anexmcmsetup.wxs:2"。我不知道如何修复这个错误。我感谢您立即提供的帮助。谢谢!

I have multiple wxs files that are generated by heat.exe. Each file has a root element Wix, two children Fragment, and each of the Fragment elements have a DirectoryRef and ComponentGroup element respectively. Sample is hereunder:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="ANEXMCM">
            <Component Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" Guid="2924A2A0-D7A2-407E-B9B8-B40AAE1204ED">
                <File Id="filABF39DC4BC6ED4474A2C2DB1C1681980" KeyPath="yes" Source="SourceDir\content.txt" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ANEXMCM_CID">
            <ComponentRef Id="cmp06C5225B7EE36AAEA9ADB0AF882F1053" />
        </ComponentGroup>
    </Fragment>
</Wix>

I included the files to the main WIX file as <?include wixfile.wxs?> . When I tried to build my project ( I tried on both Visual Studio and SharpDevelop, I even tried the command line), the error I get is "The document element name 'Wix' is invalid. A Windows Installer XML include file must use 'Include' as the document element name. (CNDL0048) - C:\WorkingDir\anexmcmsetup.wxs:2". I don't how to get this error fixed. I appreciate your immediate help. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傲鸠 2024-11-15 00:23:57

对于包含的 xws 文件,我有相同的错误消息。我将此文件的构建操作从“编译”更改为“无”,错误消失了。

I had the same error message for an included xws-File. I changed the build action for this file from "Compile" to "None" and the error disappeared.

别理我 2024-11-15 00:23:57

我遇到了类似的问题,这是因为我没有正确实现片段...

可以在这里找到片段的良好基本解释...

http://wix.tramontana.co.hu/tutorial/upgrades-and-modularization/fragments

以我为例

在我的特定场景中,我将安装程序拆分为两个 wxs 文件。

  1. Product.wxs - 主 xml 文件)
  2. FilesFragment.wxs - 包含我从 heat 获得的所有文件的 xml 文件)。

我出错的地方是我认为我需要在 Product.wxs 中包含某种引用 FilesFragment.wxs 的引用。类似于您在 C++ 项目中的做法。例如,我假设如果我想在主安装中包含一个名为 wixfile.wxs 的附加 wxs 文件,我将需要某种

这是一个不正确的假设。这种关系是在您的项目文件(以 .wixproj 结尾)中设置的,凭借它的存在,它知道该文件存在。

然后,在 Product.wxs 文件中,我需要设置一个具有 ComponentGroupRef 的功能,其 Id 引用 FilesFragment.wxs 文件中的 ComponentGroup ID。

文件内容示例...

Product.wxs 文件

 <Feature Id="ProductFeature" Title="Setup MaxCut" Level="1">
  <ComponentGroupRef Id="FilesFragment" />
</Feature>

FilesFragment.wxs 文件

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <DirectoryRef Id="APPLICATIONFOLDER">
        <Component Id="xyz" Guid="{abc...}">
            <File ... />
        </Component>
    ...       
    </DirectoryRef>
</Fragment>
...

<Fragment>
    <ComponentGroup Id="FilesFragment">
        <ComponentRef Id="xyz" />
    </ComponentGroup>
</Fragment>

这达到了我所需要的。我想这也是你正在努力做的事情吧?

I had a similar problem and it was because I wasn't implementing fragments correctly...

A good basic explanation of fragments can be found here...

http://wix.tramontana.co.hu/tutorial/upgrades-and-modularization/fragments

In my instance

In my specific scenario I had split my installer into two wxs files.

  1. Product.wxs - main xml file)
  2. FilesFragment.wxs - xml file containing all the files I got from heat).

Where I went wrong was that I thought I needed to have some sort of include reference in Product.wxs that would reference to FilesFragment.wxs. Similar to how you would do in a c++ project. For instance I assumed if I wanted to include a additional wxs file called wixfile.wxs in my main installation I would need some sort of

<?include wixfile.wxs?>

This was an incorrect assumption. This relationship is set up in your project file (ending with .wixproj), by virtue of having it there, it knows the file exists.

In the Product.wxs file I then needed to set up a Feature that had a ComponentGroupRef with an Id that referenced the ComponentGroup ID in my FilesFragment.wxs file.

Example of file contents...

Product.wxs file

 <Feature Id="ProductFeature" Title="Setup MaxCut" Level="1">
  <ComponentGroupRef Id="FilesFragment" />
</Feature>

FilesFragment.wxs file

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <DirectoryRef Id="APPLICATIONFOLDER">
        <Component Id="xyz" Guid="{abc...}">
            <File ... />
        </Component>
    ...       
    </DirectoryRef>
</Fragment>
...

<Fragment>
    <ComponentGroup Id="FilesFragment">
        <ComponentRef Id="xyz" />
    </ComponentGroup>
</Fragment>

This achieved what I needed. I think it is what you are trying to do as well?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文