Wix驱动程序安装?

问题描述 投票:0回答:1

早上你美丽的人!

我的系统管理员决定我们应该用.msi完成所有工作,并且我试图制作一个wix项目以安装基于.inf的驱动程序。

我看到一些帖子简要解释了如何做到这一点:

WIX Installer for a INF based printer Driver

但是,我真的想要一个完整的例子(整个slns文件)让我理解我需要做的结构。现在它甚至没有编译。这是我的product.wxs的内容(PS:抱歉格式化乱七八糟):

  <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="DriversTest" Language="1033" Version="1.0.0.0" 
       Manufacturer="" UpgradeCode="8caa9c0d-c692-4aa6-9267-a13577f51cb6">
    <Package InstallerVersion="200" Compressed="yes" 
      InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is 
        already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="DriversTest" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="DriversTest" />
        </Directory>
    </Directory>
</Fragment>

   <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the 
       ComponentRef below in order to add resources to this installer. -->
        <!-- <Component Id="ProductComponent"> -->
            <!-- TODO: Insert files, registry keys, and other resources 
            here. -->
        <!-- </Component> -->
         </ComponentGroup>
       </Fragment>
      </Wix>

           <Component Id="google-usb" Guid="{4fba0d21-64bb-458d-9b78-23aed7a39d14}" 
        Directory = "C:\drivers-folder\google">
         <difx:Driver Legacy='yes' />
          <File Id="Catalog" Name="androidwinusba64.cat" 
            Source="androidwinusba64.cat" />
            <File Id="Info" Name="android_winusb.inf" KeyPath="yes" 
            Source="android_winusb.inf" />
        </Component>
             <Component Id="google-usb" Guid="{4fba0d21-64bb-458d-9b78-23aed7a39d14}" Directory = "C:\drivers-folder\google">
           <difx:Driver Legacy='yes' />
            <File Id="Catalog" Name="androidwinusba64.cat" Source="androidwinusba64.cat" />
     <File Id="Info" Name="android_winusb.inf" KeyPath="yes" Source="android_winusb.inf" />
            </Component>

然后我继续调用批处理文件:

@ECHO OFF

ECHO ------------生成驱动程序安装----------------

“%WIX%bin \ candle”-ext WixDifxAppExtension * .wxs -o obj \“%WIX%bin \ light”-ext WixUIExtension -ext WixDifxAppExtension * .wixobj difxapp_x64.wixlib -o bin \ google-usb.msi

暂停

由于此错误导致失败:

Product.wxs C:\ test \ DriversTest \ DriversTest \ DriversTest \ Product.wxs(32):error CNDL0104:不是有效的源文件; detail:有多个根元素。第32行,第2位.light.exe:错误LGHT0103:系统找不到类型为“Source”的文件'* .wixobj'。按任意键继续 。 。 。

我真的可以用一只手。我是一个完全的菜鸟,我想我需要一些指导。我吮吸XML。

xml wix driver
1个回答
0
投票

您的XML格式错误。根元素<Wix>应该是底部关闭的最后一个标记,但它在文件结束之前就已经关闭了很多。这就是编译器抱怨“多个根元素”的原因。

如果您有一个能够理解XML并进行语法高亮/着色的编辑器,那么这可能会帮助您修复文件,以便所有内容都在<Wix>元素中。

这是一个格式良好的Wix源文件的示例。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
    <DirectoryRef Id="INSTALLDIRECTORY"/>
    <ComponentGroup Id="cgDeviceLayer" Directory="INSTALLDIRECTORY">
      <ComponentGroupRef Id="cgPostSharp"/>
      <ComponentGroupRef Id="cgReactiveAscom" />
      <ComponentGroupRef Id="cgPostSharpAspects" />
      <ComponentGroupRef Id="cgNLog" />
      <Component Id="cmpDeviceControlLayer" Guid="*" Win64="no">
        <File Id="filDeviceLayerAssembly"
              Source="$(var.DeviceLayer.TargetPath)"
              KeyPath="yes"
              Vital="yes"
              Assembly=".net"
              AssemblyApplication="filDeviceLayerAssembly" />
      </Component>
    </ComponentGroup>
    </Fragment>
</Wix>

注意:这不是完整的产品定义,它是从大型安装程序获取的一个文件,用作示例,显示所有内容应如何在<Wix>标记内。

© www.soinside.com 2019 - 2024. All rights reserved.