WiX 未解析对部分片段中符号媒体 1 的引用 [英] WiX unresolved reference to symbol media 1 in section fragment

查看:19
本文介绍了WiX 未解析对部分片段中符号媒体 1 的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Visual Studio 2010 中构建我的 WiX 项目,但每次构建时,我都会收到以下错误消息:

I am trying to build my WiX Project in Visual Studio 2010, but everytime I build, I receive the following error messages:

未解析对片段"部分中符号Media1"的引用

Unresolved reference to symbol 'Media1' in section 'Fragment:'

未解决对产品{67DC7AE3-030F-4A24-AC3F-7AE7D0C32D07}"部分中符号Media1"的引用

Unresolved reference to symbol 'Media1' in section 'Product{67DC7AE3-030F-4A24-AC3F-7AE7D0C32D07}'

该项目包括一个 Product.wxs 文件和一个热生成的 wxs someComponents.wxs(我的片段)文件.我在 Product.wxs 中引用了热生成的 wxs 文件中的组件.我收到错误的部分如下:

The project includes one Product.wxs file and one heat-generated wxs someComponents.wxs (my fragment) file. I am referencing components in the heat-generated wxs file in Product.wxs. The sections where I am getting the errors are as follows:

Product.wxs 文件

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="DesktopFolder" Name="Desktop"/>        
    <Directory Id="ProgramFilesFolder">
      <Directory Id="Aspex" Name="Company">
        <Directory Id="INSTALLFOLDER" Name="My App" >
          <Component Id="appFromSomeComponent">
            <File Id="AppFromSomeComponentexe" 
                  Name="AppFromSomeComponent.exe"
                  Source="$(var.AppFromSomeComponentBin)\AppFromSomeComponent.exe" />
            <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" />
          </Component>
        </Directory>
      </Directory>
    </Directory>
</Directory>

<!-- Shortcuts in the start menu-->
<DirectoryRef Id="ApplicationProgramsFolder2">
  <Component Id="StartMenuMyApp">
    <Shortcut Id="MyAPP" Directory="ApplicationProgramsFolder2"
              Name="My App" 
              WorkingDirectory="INSTALLFOLDER" 
              Target="[INSTALLFOLDER]appFromSomeComponent.exe"/>
    <RemoveFolder Id="ApplicationProgramsFolder2" On="uninstall"/>
    <RegistryValue Root="HKCU" 
                   Key="Software\Microsoft\appFromSomeComponent" 
                   Name="installed" 
                   Type="integer" 
                   Value="1" 
                   KeyPath="yes"/>
  </Component>

  <Component Id="UninstallStartMenuShortcut">
    <Shortcut Id="UninstallProduct"
      Name="Uninstall My App"
      Target="[SystemFolder]msiexec.exe"
      Arguments="/x [ProductCode]"
      Description="Uninstall My App" />
    <RemoveFolder Id="ApplicationProgramsFolder4" On="uninstall"/>
    <RegistryValue Root="HKCU" 
                   Key="Software\Microsoft\MyAppUninstall"
                   Name="installed"
                   Type="integer"
                   Value="1"
                   KeyPath="yes"/>
  </Component>
</DirectoryRef>

someComponents.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
        <Component Id="cmpEFCBE60AE731F2F72E1E191A31A5C932" 
                   Guid="{41805DA3-9F2A-45D3-82F7-46357FDA91F1}">
            <File Id="filE84D9AAD661C2BCD945C740C9DF8F5EE" 
                  KeyPath="yes"
                  Source="$(var.AppFromSomeComponentBin)\AppFromSomeComponent.exe" />
        </Component>
        <Component Id="cmpA7CD6B191FCDC253D5418CC203735124"
                   Guid="{1B1B6D45-B2A3-4D1B-AD1C-645D9D8AEE6E}">
             <File Id="fil042C8008BCA6DCC4254D61C306D2DA18"
                   KeyPath="yes"
                   Source="$(var.AppFromSomeComponentBin)\AppFromSomeComponent.exe.config" />
        </Component>
        <Component Id="cmp6A4D0A31B68BE7D2215111EE5B24D78A"
                   Guid="{BE1094E1-2658-4FB7-B3BE-172C7D90D2C5}">
            <File Id="fil5038053B907D45250FC4F7FB1AE3E3C0"
                  KeyPath="yes" 
                  Source="$(var.AppFromSomeComponentBin)\SomeDll.dll" />
        </Component>
    </DirectoryRef>
</Fragment>
<Fragment>
    <ComponentGroup Id="AppFromSomeComponentBin">
        <ComponentRef Id="cmpEFCBE60AE731F2F72E1E191A31A5C932" />
        <ComponentRef Id="cmpA7CD6B191FCDC253D5418CC203735124" />
        <ComponentRef Id="cmp6A4D0A31B68BE7D2215111EE5B24D78A" />
    </ComponentGroup>
</Fragment>
</Wix>

如果有人能指出我解决这个问题的正确方向——或者指出我遗漏的东西——那将不胜感激!另外,如果需要任何其他信息来帮助回答这个问题,也请告诉我,我会尽量提供尽可能多的信息.

If someone could point me in the right direction to resolve this issue--or maybe point out something I am missing--that would be greatly appreciated! Also please let me know if any additional information is needed to help answer this question, I try and provide as much information as possible.

推荐答案

错误消息试图说明您缺少带有 Id='1'Media 元素.通常,您会在 Product 元素下找到 Media 元素.您只需要添加如下内容:

The error message is trying say that you are missing a Media element with Id='1'. Usually, you'll find the Media element under the Product element. You just need to add something like:

<Media Id='1' />

然后您可以向 Media 元素添加其他属性,以将您的文件压缩到一个文件柜中.在 WiX 工具集的更高版本中,您可以使用 MediaTemplate 元素而不是 Media 元素来创建不超过特定大小的多个机柜.如果您最终拥有大量文件,那就太好了.

You can then add other attributes to the Media element to compress your files into a cabinet. With later versions of the WiX toolset you can use the MediaTemplate element instead of the Media element to create multiple cabinets that do not exceed a certain size. That's great if you end up with lots of files.

这篇关于WiX 未解析对部分片段中符号媒体 1 的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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