1
votes

Morning you beautiful people!

My sysadmin as decided that we should do everything with .msi and I am stuck trying to make a wix project to install .inf based drivers.

I saw some post explaining briefly how to do this like:

WIX Installer for a INF based printer Driver

However, I would really like a complete example (whole slns file) to make me understand the structure I need to do. Right now it doesn't even compile. Here's the content of my product.wxs (PS:Sorry for the formatting mess):

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

I then proceed to call as a batch file this:

@ECHO OFF

ECHO ------------Generating drivers install----------------

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

PAUSE

Which fails because of this error:

Product.wxs C:\test\DriversTest\DriversTest\DriversTest\Product.wxs(32) : error CNDL0104 : Not a valid source file; detail: There are multiple root elements. Line 32, position 2. light.exe : error LGHT0103 : The system cannot find the file '*.wixobj' with type 'Source'. Press any key to continue . . .

I could really use a hand. I am a total noob at this and I think I need some guidance. I suck at XML.

1
I'm close I can feel it! Your link helped a lot. I updated my code and I have only one error left: The Component element contains an unhandled extension element 'difx:Driver'. Please ensure that the extension for elements in the 'schemas.microsoft.com/wix/DifxAppExtension' namespace has been provided. Got an idea how to do this?Axiom
Check the github link to a sample there. See the namespace added at the top? You probably need a dll reference too - which you add at the Visual Studio project level. Not sure.Stein Åsmul
Axiom, that was a very rushed comment, did you get a heartbeat going?Stein Åsmul
I'm excitable and I tried to get this working for 3 days now.Axiom

1 Answers

1
votes

Your XML is badly formed. The root element <Wix> should be the last tag closed at the bottom but it is closed quite a way before the end of the file. This is why the compiler is complaining about "multiple root elements".

If you have an editor that understands XML and does syntax highlighting/coloring, then that will probably help you fix up the file so that everything is inside the <Wix> element.

Here is an example of a well-formed Wix source file.

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

Note: this isn't a full product definition, it is one file taken from a large installer to serve as an example showing how all of the content should be inside the <Wix> tags.