我可以获得有关“未处理的子文件节点环境”问题的帮助吗?

发布于 2025-01-13 11:52:21 字数 6226 浏览 0 评论 0原文

我陷入了这个“子节点错误”,我真的不知道为什么会出现这个问题。

这是我的代码:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0' Id='YOURGUID-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='YOURGUID-7349-453F-94F6-BCB5110BA4FD'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='test'>
<Package Id='*' Keywords='Installer' Description="test Project 1.0 Installer"
  Comments='It is a test for test project.' Manufacturer='test.'
  InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="test 1.0 Installation [1]" />

<Icon Id='icon.ico' SourceFile='icon.ico' />
<Property Id='ARPPRODUCTICON' Value='icon.ico' />

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id='ProgramFilesFolder' Name='PFiles'>
    <Directory Id='Acme' Name='test'>
      <Directory Id='INSTALLDIR' Name='test 1.0'>

        <Component Id='MainExecutable' Guid='YOURGUID-83F1-4F22-985B-FDB3C8ABD471'>
          <File Id='FoobarEXE' Name='test.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'>

<!-- Here is the env -->
          <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />

            <Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="test 1.0" WorkingDirectory:'INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
            <Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Name="test 1.0" WorkingDirectory='INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
          </File>
        </Component>

        <Component Id='HelperLibrary' Guid='YOURGUID-6BE3-460D-A14F-75658D16550B'>
          <File Id='HelperDLL' Name='Helper.dll' DiskId='1' Source='Helper.dll' KeyPath='yes' />
        </Component>

        <Component Id='Manual' Guid='YOURGUID-574D-4A9A-A266-5B5EC2C022A4'>
          <File Id='Manual' Name='Manual.pdf' DiskId='1' Source='Manual.pdf' KeyPath='yes'>
            <Shortcut Id="startmenuManual" Directory="ProgramMenuDir" Name="Instruction Manual" Advertise="yes" />
          </File>
        </Component>

      </Directory>
    </Directory>
  </Directory>

  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ProgramMenuDir" Name="Foobar 1.0">
      <Component Id="ProgramMenuDir" Guid="YOURGUID-7E98-44CE-B049-C477CC0A2B00">
        <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
        <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
      </Component>
    </Directory>
  </Directory>

  <Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
      <ComponentRef Id='HelperLibrary' />
      <ComponentRef Id='Manual' />
      <ComponentRef Id='ProgramMenuDir' />
    </Feature>
  </Product>
</Wix>

我得到:

$ wixl -v SampleFirst.wxs
Loading SampleFirst.wxs...

(wixl:3778): wixl-ERROR **: 11:22:33.398: wix.vala:218: unhandled child File node Environment

我尝试添加环境,但我不知道为什么我得到它,我检查其他答案

任何人都可以给我一个在 WIX 中修改 Windows 环境系统变量的示例吗?)

(使用 WiX 工具集 MSI 安装程序在客户端计算机上设置环境变量< /a>)

并且总是相同的错误...

这是另一个测试:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" 
      Name="My Software" 
      Language="1033" 
      Version="1.0.0.0" 
      Manufacturer="My Company" 
      UpgradeCode="889e2707-5235-4d97-b178-cf0cb55d8ab8">
    <Package InstallerVersion="200" 
      Compressed="yes" 
      InstallScope="perMachine" />

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

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

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" 
          Name="My Software" />
      </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> -->

    <Component Id="cmpEnvironmentVariable" 
       Guid="{313075B5-BF2C-4012-9A6E-2F4E2C461306}"  
       KeyPath="yes">
       <Environment Id="myEnvironmentVariable"  
           Name="MyVariable" 
           Value="some value" 
           Action="set" 
           System="yes" />
           
    </Component>
</ComponentGroup>
</Fragment>
</Wix>

我得到:

$ wixl -v EnvironmentVariableInstaller.wxs 
Loading EnvironmentVariableInstaller.wxs...

(wixl:6595): GLib-GObject-WARNING **: 17:49:16.893: g_object_set_is_valid_property: object class 'WixlWixComponent' has no property named 'KeyPath'

(wixl:6595): wixl-ERROR **: 17:49:16.893: wix.vala:218: unhandled child Component node Environment

所以如果有人有解决方案,它将对我有很大帮助! 谢谢

i'm stuck on this "child node error" and i really don't know why i got that.

there is my code:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0' Id='YOURGUID-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='YOURGUID-7349-453F-94F6-BCB5110BA4FD'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='test'>
<Package Id='*' Keywords='Installer' Description="test Project 1.0 Installer"
  Comments='It is a test for test project.' Manufacturer='test.'
  InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="test 1.0 Installation [1]" />

<Icon Id='icon.ico' SourceFile='icon.ico' />
<Property Id='ARPPRODUCTICON' Value='icon.ico' />

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id='ProgramFilesFolder' Name='PFiles'>
    <Directory Id='Acme' Name='test'>
      <Directory Id='INSTALLDIR' Name='test 1.0'>

        <Component Id='MainExecutable' Guid='YOURGUID-83F1-4F22-985B-FDB3C8ABD471'>
          <File Id='FoobarEXE' Name='test.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'>

<!-- Here is the env -->
          <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />

            <Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="test 1.0" WorkingDirectory:'INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
            <Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Name="test 1.0" WorkingDirectory='INSTALLDIR' Icon="icon.ico" IconIndex="0" Advertise="yes" />
          </File>
        </Component>

        <Component Id='HelperLibrary' Guid='YOURGUID-6BE3-460D-A14F-75658D16550B'>
          <File Id='HelperDLL' Name='Helper.dll' DiskId='1' Source='Helper.dll' KeyPath='yes' />
        </Component>

        <Component Id='Manual' Guid='YOURGUID-574D-4A9A-A266-5B5EC2C022A4'>
          <File Id='Manual' Name='Manual.pdf' DiskId='1' Source='Manual.pdf' KeyPath='yes'>
            <Shortcut Id="startmenuManual" Directory="ProgramMenuDir" Name="Instruction Manual" Advertise="yes" />
          </File>
        </Component>

      </Directory>
    </Directory>
  </Directory>

  <Directory Id="ProgramMenuFolder" Name="Programs">
    <Directory Id="ProgramMenuDir" Name="Foobar 1.0">
      <Component Id="ProgramMenuDir" Guid="YOURGUID-7E98-44CE-B049-C477CC0A2B00">
        <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
        <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
      </Component>
    </Directory>
  </Directory>

  <Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
      <ComponentRef Id='HelperLibrary' />
      <ComponentRef Id='Manual' />
      <ComponentRef Id='ProgramMenuDir' />
    </Feature>
  </Product>
</Wix>

And i got :

$ wixl -v SampleFirst.wxs
Loading SampleFirst.wxs...

(wixl:3778): wixl-ERROR **: 11:22:33.398: wix.vala:218: unhandled child File node Environment

I try to add environment but i don't know why i got that, i check other answers

(Can anyone give me a example of modifying windows environment system variables in WIX?)

(Set Environment variable on client machine using WiX toolset MSI installer)

and it's allways the same error...

Here is another test:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" 
      Name="My Software" 
      Language="1033" 
      Version="1.0.0.0" 
      Manufacturer="My Company" 
      UpgradeCode="889e2707-5235-4d97-b178-cf0cb55d8ab8">
    <Package InstallerVersion="200" 
      Compressed="yes" 
      InstallScope="perMachine" />

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

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

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" 
          Name="My Software" />
      </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> -->

    <Component Id="cmpEnvironmentVariable" 
       Guid="{313075B5-BF2C-4012-9A6E-2F4E2C461306}"  
       KeyPath="yes">
       <Environment Id="myEnvironmentVariable"  
           Name="MyVariable" 
           Value="some value" 
           Action="set" 
           System="yes" />
           
    </Component>
</ComponentGroup>
</Fragment>
</Wix>

And i got :

$ wixl -v EnvironmentVariableInstaller.wxs 
Loading EnvironmentVariableInstaller.wxs...

(wixl:6595): GLib-GObject-WARNING **: 17:49:16.893: g_object_set_is_valid_property: object class 'WixlWixComponent' has no property named 'KeyPath'

(wixl:6595): wixl-ERROR **: 17:49:16.893: wix.vala:218: unhandled child Component node Environment

So if someone have the solution it will help me a lot !
Thx

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

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

发布评论

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

评论(1

二货你真萌 2025-01-20 11:52:21

不确定 wixl,但在 WiX 中,EnvironmentComponent 的子级,而不是 File

Not sure about wixl, but in WiX, Environment is a child of Component, not File.

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