【问题标题】:Unresolved reference to symbol in WiX (LGHT0094) (No illegal characters?)未解决的 WiX (LGHT0094) 中对符号的引用(没有非法字符?)
【发布时间】:2014-06-18 19:28:09
【问题描述】:

我在这里搜索过答案,但由于每个案例似乎都是独一无二的,到目前为止没有任何答案对我有帮助,所以我决定发布自己的答案。出于某种原因,我收到有关以下代码的以下错误。我似乎找不到任何问题。据我所知,它没有非法字符。我尝试了使用和不使用 " 并没有什么区别。错误中特别引用的行是动词行。

错误:

C:\Users\kylec\Desktop\SampleFirst\SampleFirst.wxs(25) : error LGHT0094 : 
Unresolved reference to symbol 'File:Viewer.exe' in section 
'Product:{00000000-0000-0000-0000000000000000}'.

代码:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Viewer 1.0' Id='PUT-GUID-HERE' UpgradeCode='PUT-GUID-HERE'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Direct'>
    <Package Id='*' Keywords='Installer' Description="Installer"
      Comments='Installer is a registered trademark of Direct' 
      Manufacturer='Direct' InstallerVersion='100' Languages='1033' 
      Compressed='yes' SummaryCodepage='1252' />

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

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='DataMotionDirect' Name='DMD'>
          <Directory Id='INSTALLDIR' Name='Viewer'>

           <Component Id='MainExecutable' Guid='*'>
               <Shortcut Id="startmenuViewer" Directory="ProgramMenuDir" 
                         Name="Viewer" WorkingDirectory='INSTALLDIR' 
                         Icon="Viewer.exe" IconIndex="0" Advertise="yes" />
                <Shortcut Id="desktopViewer" Directory="DesktopFolder" 
                          Name="Viewer" WorkingDirectory='INSTALLDIR' 
                          Icon="Viewer.exe" IconIndex="0" Advertise="yes" />

              <File Id='EXE' Name='Viewer.exe' DiskId='1' 
                    Source='Viewer.exe' KeyPath='yes'>
              </File>
        <ProgId Id="DMDCCDAV" Description="Viewer">
          <Extension Id="xml" >
            <Verb Id="open" Argument="&quot;%1&quot;" TargetFile="Viewer.exe" />
          </Extension>
        </ProgId>
            </Component>

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

      <Directory Id="ProgramMenuFolder" Name="Programs">
       <Directory Id="ProgramMenuDir" Name="Viewer">
        <Component Id="ProgramMenuDir" Guid="*">
         <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='ProgramMenuDir' />
    </Feature>

    <Icon Id="Viewer.exe" SourceFile="Viewer.exe" />

  </Product>
</Wix>

【问题讨论】:

  • 您确定错误是在引用该代码(即在第 25 行)吗?我在该代码 sn-p 中没有看到与“Viewer.exe”相关的任何内容。
  • 糟糕更新了问题。忘了我改了可执行文件名。
  • 您在哪里定义了File 元素(在Component 中)与“Viewer.exe”的NameId
  • @PeterRitchie 我已经更新了我的问题以包含条目组件。它的 ID 是 MainExecutable 但包含一个名为 Viewer.exe 的文件

标签: wix installation windows-installer


【解决方案1】:

从您指定的源代码中,并不清楚 wix 实际上引用了哪些实际字符串。您能否突出显示字符串或发布整个文件?

好的,在您发布整个文件后,我看到了有问题的行。您必须在此处使用文件 ID 而不是文件名。

【讨论】:

  • 好吧,至少我知道问题出在哪里了。 TargetFile 必须是您之前添加到文件表中的文件的 ID。请参阅有关动词元素的文档:wixtoolset.org/documentation/manual/v3/xsd/wix/verb.html
  • 但不是文件名。
  • 哦,那应该是这样的吧?
  • 天哪,修复了它。谢谢!
  • 我想 - 是的。我上一次接触 WiX 是在 2006 年。
【解决方案2】:

我没有设置 Wix 来尝试此操作,但您可以尝试将 Shortcut 元素 向上移动以嵌套在 Component 元素 下,而不是 文件元素。然后设置WorkingFolder 属性。尝试类似this

就像我说的,我无法编译和测试,但尝试将 Target 属性 设置为: Target="[#Viewer.exe]"

<Shortcut Id="ApplicationStartMenuShortcut" 
          Name="My Application Name" 
          Description="My Application Description"
          Target="[#Viewer.exe]"
          WorkingDirectory="INSTALLDIR"/>

【讨论】:

  • 我试过了,但不幸的是我得到了同样的错误。
  • 好的,我试过了,得到了同样的错误。请记住,引用的行是动词行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-09-12
  • 1970-01-01
相关资源
最近更新 更多