如何在Wix(命令行)中引用热量输出(wxs)

时间:2016-08-26 17:01:40

标签: windows wix windows-installer

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

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

生成输出文件后,如何将其添加到“Main.wxs”文件中? (请相当明确,对此不熟悉)

我已经四处寻找第二个问题的答案了,我总是想出一些含糊不清的东西或VS,我在命令行工作。谢谢!

这是我到目前为止所尝试的:我收到错误:(LGHT0103:系统找不到文件“file”)我的所有文件都出现此错误。

<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>

1 个答案:

答案 0 :(得分:0)

您可以剪切组件节点并将其粘贴到主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。

最后合并样本,显示使用heat.exe工具中提取的组件节点填充的主要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>

              <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