WiX(LGHT0094)中对符号的未解析引用(没有非法字符?)

WiX(LGHT0094)中对符号的未解析引用(没有非法字符?),wix,installation,windows-installer,Wix,Installation,Windows Installer,我在这里搜索答案,但由于每个案例似乎都是独一无二的,到目前为止没有任何答案对我有帮助,我决定发布自己的答案。由于某种原因,我得到以下关于以下代码的错误。我似乎找不出有什么毛病。据我所知,它没有非法字符。我试过使用和不使用“这没有什么区别。错误中特别提到的那行是动词行 错误: C:\Users\kylec\Desktop\SampleFirst\SampleFirst.wxs(25) : error LGHT0094 : Unresolved reference to symbol 'File:

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

错误:

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>
代码:

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>

我没有Wix设置来尝试此操作,但是您可以尝试将快捷方式元素向上移动,以嵌套在组件元素下,而不是文件元素。然后设置工作文件夹属性。尝试类似的操作

正如我所说,我无法编译和测试,但请尝试将目标属性设置为: Target=“[#Viewer.exe]”


从您指定的源代码中,不清楚wix实际引用了什么字符串。请突出显示该字符串或发布整个文件


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

您确定错误引用了该代码(即第25行)?我没有看到与“Viewer.exe”相关的任何内容“在那个代码片段中。Oops更新了问题。忘记我更改了可执行文件的名称。您在哪里定义了一个
文件
元素(在
组件
中),其
名称为
Id
为“Viewer.exe”?@PeterRitchie我已经更新了我的问题以包括entrie组件。它的ID是main可执行文件,但包含一个名为Viewer.exe的文件。我尝试了这个方法,但不幸的是,我得到了相同的错误。好的,我尝试了这个方法,得到了相同的错误。请记住,所引用的行是动词行。好吧,至少我知道问题出在哪里了。TargetFile必须是先前添加到文件表中的文件的ID。查看动词元素上的文档:但不是文件名。哦,那么应该是这样的?天哪,那把它修好了。非常感谢。我想是的。我上次与WiX联系是在2006年。