WiX未解析的部分片段中对符号媒体1的引用

标签 wix wix3.5

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

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

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


该项目包括一个Product.wxs文件和一个热生成的wxs someComponents.wxs(我的片段)文件。我在Product.wxs的热量生成的wxs文件中引用了组件。我遇到错误的部分如下:
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>
如果有人可以指出正确的方向来解决此问题,或者指出我缺少的内容,将不胜感激!另外请让我知道是否需要任何其他信息来帮助回答这个问题,我会尝试提供尽可能多的信息。

最佳答案

错误消息试图说您缺少MediaId='1'元素。通常,您会在Media元素下找到Product元素。您只需要添加以下内容:

<Media Id='1' />

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

关于WiX未解析的部分片段中对符号媒体1的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16400208/

相关文章:

WiX EmbeddedChainer 示例?

Wix 工具集 : create directory in root disk (system disk or c:\) and copy files inside

sql - 如何在 Wix 中添加测试 sql 连接按钮

wix - 如果服务未启动则继续

Wix,我在哪里可以找到 WixUI_InstallDir.wxs 和 InstallDirDlg.wxs

wix - 我可以使用 WiX 设置自定义许可证吗?

VSTS 和 WIX 上的 MSBuildExtensionsPath

.net - 如何区分 WIX 中的正常安装和升级?

Wix 不会将 var.publishDir 插入 wxs 文件中

WiX:构建服务器构建中神秘且难以诊断的 ICE 验证错误