【问题标题】:How to Reference a Heat Output(wxs) in Wix (Command Line)如何在 Wix(命令行)中引用热量输出(wxs)
【发布时间】:2023-03-10 11:25:01
【问题描述】:

我正在使用 heat.exe 生成一个 .wxs 文件,以将文件包含在我的主安装程序中。我有两个问题:

我将使用哪些开关来注册 DLL?

生成输出文件后,如何将其添加到“Main.wxs”文件中? (请非常明确,新手)

我环顾四周寻找第二个问题的答案,但我总是想出一些模糊的东西,或者对于 VS,我是从命令行工作的。谢谢!

这是我迄今为止尝试过的:我收到错误:(LGHT0103:系统找不到文件“文件”)我的所有文件都收到此错误。

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <Component Id="cmp1D2A500FA963CF9DB333FD18154B94BC" Guid="{8DE755D7-F1F9-4EC3-BCD5-B72360B8752A}">
    <File Id="filCBD973AD942425DC5F533B29866FEF5A" KeyPath="yes" Source="SourceDir\DLLs\FP7000-Camera.dll" />
  </Component>
  <Component Id="cmp4CC93670B061A60B94C1867DCFAAAED0" Guid="{717E0819-2842-4C0D-BFAB-30E4C8C66F7E}">
    <File Id="fil7CEC0F75EDE8EEF9C7F6D563E8D04EF9" KeyPath="yes" Source="SourceDir\DLLs\libmfxsw64.dll" />
  </Component>
  <Component Id="cmpE80ACF08DF44E67E7583F35557C8EB02" Guid="{4CAA0627-45DB-4E34-9B4C-C54B5E21346C}">
    <File Id="fil1E619A89A3D0D2FDE446E60B3D3EB2AF" KeyPath="yes" Source="SourceDir\DLLs\pthreadVC2.dll" />
  </Component>
    </ComponentGroup>
</Fragment>

【问题讨论】:

    标签: windows wix windows-installer


    【解决方案1】:

    您可以剪切组件节点并将它们粘贴到主 wxs 文件中的正确安装目录中。作为示例,您可以查看这个简单的模型:

          <?xml version="1.0"?>
          <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
             <Product Id="*" UpgradeCode="put-guid-here" 
                     Name="Example Product Name" Version="0.0.1"
                     Manufacturer="Example Company Name" Language="1033">
            <Package InstallerVersion="200" Compressed="yes" 
                     Comments="Windows Installer Package"/>
    
          <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
          <Directory Id="TARGETDIR" Name="SourceDir">
             <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLDIR" Name="Example">
                   <Component Id="FP7000-Camera.dll" Guid="*">
                      <File Id="FP7000-Camera.dll" Source="replace with path to FP7000-Camera.dll"/>
                   </Component>
    
                   further components can be added here.
    
                </Directory>
             </Directory>
          </Directory>
    
            <Feature Id="DefaultFeature" Level="1">
              <ComponentRef Id="FP7000-Camera.dll"/>
            </Feature>
    
           </Product>
          </Wix>
    

    您应该为您的 COM 文件提取 COM 数据。这是一个示例 Heat.exe 命令。 (注意:如果您的 dll 由于缺少依赖项而无法加载,您可能需要在运行提取之前安装您的 sdk 设置):

    heat file MyComFile.ocx -out MyComFile.wxs
    

    在 MyComFile.wxs 中提取出来的 COM 数据将如下所示:

    <?xml version="1.0" encoding="utf-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
        <Fragment>
            <DirectoryRef Id="TARGETDIR">
                <Directory Id="dirE645D1B018BB48C41BDBE188A129817F" Name="wix310-binaries" />
            </DirectoryRef>
        </Fragment>
        <Fragment>
            <DirectoryRef Id="dirE645D1B018BB48C41BDBE188A129817F">
    
                cut from here
    
                <Component Id="cmpD8BB195A00599F06D2FF16982DBAA523" Guid="PUT-GUID-HERE">
                    <File Id="filBDC3CFD8FF09857ADE9793AF172F66E6" KeyPath="yes" Source="SourceDir\wix310-binaries\ITDetector.ocx">
                        <TypeLib Id="{D6995525-B33A-4980-A106-9DF58570CC66}" Description="ITDetector 1.0 Type Library" HelpDirectory="dirE645D1B018BB48C41BDBE188A129817F" Language="0" MajorVersion="1" MinorVersion="0">
                            <Class Id="{D719897A-B07A-4C0C-AEA9-9B663A28DFCB}" Context="InprocServer32" Description="iTunesDetector Class" ThreadingModel="apartment" Programmable="yes" SafeForScripting="yes" SafeForInitializing="yes">
                                <ProgId Id="ITDetector.iTunesDetector.1" Description="iTunesDetector Class">
                                    <ProgId Id="ITDetector.iTunesDetector" Description="iTunesDetector Class" />
                                </ProgId>
                            </Class>
                            <Interface Id="{45D2C838-0137-4E6A-AA3B-D39B4A1A1A28}" Name="IiTunesDetector" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
                        </TypeLib>
                    </File>
                </Component>
    
              to here
    
            </DirectoryRef>
        </Fragment>
    </Wix>
    

    将组件粘贴到您的主 wxs 文件中的相应目录位置。例如在上面第一个 WXS 文件中所示的 INSTALLDIR 中。

    最后一个合并的示例显示了主 wxs 文件,其中填充了从 heat.exe 工具中提取的组件节点:

          <?xml version="1.0"?>
          <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
             <Product Id="*" UpgradeCode="put-guid-here" 
                     Name="Example Product Name" Version="0.0.1"
                     Manufacturer="Example Company Name" Language="1033">
            <Package InstallerVersion="200" Compressed="yes" 
                     Comments="Windows Installer Package"/>
    
          <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
          <Directory Id="TARGETDIR" Name="SourceDir">
             <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLDIR" Name="Example">
    
                   <Component Id="FP7000-Camera.dll" Guid="*">
                      <File Id="FP7000-Camera.dll" Source="replace with path to FP7000-Camera.dll"/>
                   </Component>
    
                  <Component Id="cmpD8BB195A00599F06D2FF16982DBAA523" Guid="*">
                    <File Id="filBDC3CFD8FF09857ADE9793AF172F66E6" KeyPath="yes" Source="SourceDir\wix310-binaries\ITDetector.ocx">
                        <TypeLib Id="{D6995525-B33A-4980-A106-9DF58570CC66}" Description="ITDetector 1.0 Type Library" HelpDirectory="dirE645D1B018BB48C41BDBE188A129817F" Language="0" MajorVersion="1" MinorVersion="0">
                            <Class Id="{D719897A-B07A-4C0C-AEA9-9B663A28DFCB}" Context="InprocServer32" Description="iTunesDetector Class" ThreadingModel="apartment" Programmable="yes" SafeForScripting="yes" SafeForInitializing="yes">
                                <ProgId Id="ITDetector.iTunesDetector.1" Description="iTunesDetector Class">
                                    <ProgId Id="ITDetector.iTunesDetector" Description="iTunesDetector Class" />
                                </ProgId>
                            </Class>
                            <Interface Id="{45D2C838-0137-4E6A-AA3B-D39B4A1A1A28}" Name="IiTunesDetector" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
                        </TypeLib>
                    </File>
                  </Component>
    
    
                </Directory>
             </Directory>
          </Directory>
    
            <Feature Id="DefaultFeature" Level="1">
              <ComponentRef Id="FP7000-Camera.dll"/>
              <ComponentRef Id="cmpD8BB195A00599F06D2FF16982DBAA523"/>
    
            </Feature>
    
           </Product>
          </Wix>
    

    如果以上不清楚,请尝试阅读此答案:How to run heat.exe and register a dll in wix

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-04
      • 2016-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-22
      相关资源
      最近更新 更多