2017-08-31 59 views
0

您好,我對WiX真的很陌生。我有一個應用程序,我需要同時安裝驅動程序(.inf,.cat,.sys)以及桌面圖標開始菜單快捷方式等等。我嘗試過實施不同的代碼,這與來自SO的這樣的代碼有關,但沒有太多的運氣,我也嘗試過KK的博客,並嘗試遵循他的例子。仍然沒有運氣,我可以讓桌面圖標和開始菜單圖標進行安裝,但在安裝其他應用程序時,還需要安裝此應用程序的驅動程序。是否有人可以直接向我提供可以遵循的示例。如何使用WiX部署基於INF的USB驅動程序加上所有開始菜單快捷方式和桌面圖標

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension"> 

<?define CyUSB_TargetDir=$(var.CyUSB.TargetDir)?> 
<?define RAMware3_TargetDir=$(var.RAMware3.TargetDir)?> 

<Product Id="*" Name="RamWare3" Language="1033" Version="1.0.0.0" Manufacturer="Resodyn Acoustic Mixers" UpgradeCode="*"> 

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

    <Icon Id="rw3.ico" SourceFile="$(var.ProjectDir)License\rw3.ico" /> 
    <Property Id="ARPPRODUCTICON" Value="rw3.ico" /> 

    <WixVariable Id="WixUIBannerBmp" Value="License\installer_top-banner.bmp" /> 
    <WixVariable Id="WixUIDialogBmp" Value="License\installer_background.bmp" /> 
    <WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)License\License.rtf" /> 

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" /> 
    <UIRef Id="WixUI_InstallDir" /> 

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

    <Feature Id="ProductFeature" Title="RamWare3" Level="1"> 
     <ComponentGroupRef Id="ProductComponents" /> 
     <ComponentRef Id="ApplicationShortcut" /> 
     <ComponentRef Id="ApplicationShortcutDesktop" /> 
     <ComponentGroupRef Id="ProgramFilesFolder_files" /> 
     <ComponentGroupRef Id="ApplicationProgramsFolder_files" /> 
    </Feature> 

    <Feature Id="MyDrivers" Title="My Drivers"> 
     <Component Id="Drivers" Directory="DriverDir" Guid="*"> 
     <File Id="reusb.inf" Source="$(var.ProjectDir)\Drivers\reusb.inf" /> 
     <File Id="reusb.sys" Source="$(var.ProjectDir)\Drivers\reusb.sys" KeyPath="yes" /> 
     <File Id="WdfCoinstaller01011.dll" Source="$(var.ProjectDir)\Drivers\WdfCoinstaller01011.dll" /> 
     <difx:Driver AddRemovePrograms="no" Legacy="no" PlugAndPlayPrompt="no" Sequence="1" /> 
     </Component> 
    </Feature> 
</Product> 

<Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFilesFolder"> 
     <Directory Id="INSTALLFOLDER" Name="RamWare3"> 
     </Directory> 
     </Directory> 
     <Directory Id="ProgramMenuFolder"> 
     <Directory Id="ApplicationProgramsFolder" Name="Resodyn Acoustic Mixers"/> 
     </Directory> 
     <Directory Id="DesktopFolder" Name="Desktop" /> 
    </Directory> 
</Fragment> 

<Fragment> 
    <DirectoryRef Id="ApplicationProgramsFolder"> 
     <Component Id="ApplicationShortcut" Guid="*"> 
     <Shortcut Id="ApplicationStartMenuShortcut" Name="RamWare3" Description="RamWare3" Target="[INSTALLFOLDER]RamWare3.exe" WorkingDirectory="INSTALLFOLDER" /> 
     <RemoveFolder Id="RemoveApplicationProgramsFolder" Directory="ApplicationProgramsFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\RamWare3" Name="installed" Type="integer" Value="1" KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
    <DirectoryRef Id="DesktopFolder"> 
     <Component Id="ApplicationShortcutDesktop" Guid="*"> 
     <Shortcut Id="ApplicationDesktopShortcut" Name="RamWare3" Description="RamWare3" Target="[INSTALLFOLDER]RamWare3.exe" WorkingDirectory="INSTALLFOLDER" /> 
     <RemoveFolder Id="RemoveDesktopFolder" Directory="DesktopFolder" On="uninstall" /> 
     <RegistryValue Root="HKCU" Key="Software\RamWare3" Name="installed" Type="integer" Value="1" KeyPath="yes" /> 
     </Component> 
    </DirectoryRef> 
</Fragment> 

<Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <Component Id="CyUSB.dll" Guid="*"> 
     <File Id="CyUSB.dll" Name="CyUSB.dll" Source="$(var.CyUSB_TargetDir)CyUSB.dll" /> 
     </Component> 
     <Component Id="RAMware3.exe" Guid="*"> 
     <File Id="RAMware3.exe" Name="RAMware3.exe" Source="$(var.RAMware3_TargetDir)RAMware3.exe" /> 
     </Component> 
     <Component Id="RAMware3.exe.config" Guid="*"> 
     <File Id="RAMware3.exe.config" Name="RAMware3.exe.config" Source="$(var.RAMware3_TargetDir)RAMware3.exe.config" /> 
     </Component> 
     <Component Id="Microsoft.Practices.ServiceLocation.dll" Guid="*"> 
     <File Id="Microsoft.Practices.ServiceLocation.dll" Name="Microsoft.Practices.ServiceLocation.dll" Source="$(var.RAMware3_TargetDir)Microsoft.Practices.ServiceLocation.dll" /> 
     </Component> 
     <Component Id="Nito.AsyncEx.Concurrent.dll" Guid="*"> 
     <File Id="Nito.AsyncEx.Concurrent.dll" Name="Nito.AsyncEx.Concurrent.dll" Source="$(var.RAMware3_TargetDir)Nito.AsyncEx.Concurrent.dll" /> 
     </Component> 
     <Component Id="Nito.AsyncEx.dll" Guid="*"> 
     <File Id="Nito.AsyncEx.dll" Name="Nito.AsyncEx.dll" Source="$(var.RAMware3_TargetDir)Nito.AsyncEx.dll" /> 
     </Component> 
     <Component Id="Nito.AsyncEx.Enlightenment.dll" Guid="*"> 
     <File Id="Nito.AsyncEx.Enlightenment.dll" Name="Nito.AsyncEx.Enlightenment.dll" Source="$(var.RAMware3_TargetDir)Nito.AsyncEx.Enlightenment.dll" /> 
     </Component> 
     <Component Id="Microsoft.Threading.Tasks.Extensions.Desktop.dll" Guid="*"> 
     <File Id="Microsoft.Threading.Tasks.Extensions.Desktop.dll" Name="Microsoft.Threading.Tasks.Extensions.Desktop.dll" Source="$(var.RAMware3_TargetDir)Microsoft.Threading.Tasks.Extensions.Desktop.dll" /> 
     </Component> 
     <Component Id="Microsoft.Threading.Tasks.Extensions.dll" Guid="*"> 
     <File Id="Microsoft.Threading.Tasks.Extensions.dll" Name="Microsoft.Threading.Tasks.Extensions.dll" Source="$(var.RAMware3_TargetDir)Microsoft.Threading.Tasks.Extensions.dll" /> 
     </Component> 
     <Component Id="Microsoft.Threading.Tasks.dll" Guid="*"> 
     <File Id="Microsoft.Threading.Tasks.dll" Name="Microsoft.Threading.Tasks.dll" Source="$(var.RAMware3_TargetDir)Microsoft.Threading.Tasks.dll" /> 
     </Component> 
     <Component Id="System.Threading.Tasks.Dataflow.dll" Guid="*"> 
     <File Id="System.Threading.Tasks.Dataflow.dll" Name="System.Threading.Tasks.Dataflow.dll" Source="$(var.RAMware3_TargetDir)System.Threading.Tasks.Dataflow.dll" /> 
     </Component> 
     <Component Id="System.Windows.Interactivity.dll" Guid="*"> 
     <File Id="System.Windows.Interactivity.dll" Name="System.Windows.Interactivity.dll" Source="$(var.RAMware3_TargetDir)System.Windows.Interactivity.dll" /> 
     </Component> 
     <Component Id="GalaSoft.MvvmLight.Extras.dll" Guid="*"> 
     <File Id="GalaSoft.MvvmLight.Extras.dll" Name="GalaSoft.MvvmLight.Extras.dll" Source="$(var.RAMware3_TargetDir)GalaSoft.MvvmLight.Extras.dll" /> 
     </Component> 
     <Component Id="GalaSoft.MvvmLight.dll" Guid="*"> 
     <File Id="GalaSoft.MvvmLight.dll" Name="GalaSoft.MvvmLight.dll" Source="$(var.RAMware3_TargetDir)GalaSoft.MvvmLight.dll" /> 
     </Component> 
     <Component Id="GalaSoft.MvvmLight.Platform.dll" Guid="*"> 
     <File Id="GalaSoft.MvvmLight.Platform.dll" Name="GalaSoft.MvvmLight.Platform.dll" Source="$(var.RAMware3_TargetDir)GalaSoft.MvvmLight.Platform.dll" /> 
     </Component> 
    </ComponentGroup> 
</Fragment> 

    <Fragment> 
     <ComponentGroup Id="ApplicationProgramsFolder_files" Directory="ApplicationProgramsFolder"> 
     <Component Id="DLLs_CyUSB.dll" Guid="*"> 
      <File Id="DLLs_CyUSB.dll" Name="CyUSB.dll" Source="$(var.RAMware3_TargetDir)DLLs\CyUSB.dll" /> 
     </Component> 
     <Component Id="DLLs_Bootloader_Utils.dll" Guid="*"> 
      <File Id="DLLs_Bootloader_Utils.dll" Name="Bootloader_Utils.dll" Source="$(var.RAMware3_TargetDir)DLLs\Bootloader_Utils.dll" /> 
     </Component> 
     </ComponentGroup> 
    </Fragment> 
</Wix> 

回答

1

您將要使用的DIFX擴展,您可以通過添加xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension"到維克斯標籤訪問。您還需要將對difxapp_x86.wixlib或difxapp_x64.wixlib的引用添加到您的項目中。

你需要像這樣引用它:

<Feature Id="MyDrivers" Title="My Drivers"> 
    <Component Id="Drivers" Directory="DriverDir" Guid="*"> 
     <File Id="MyDriver.cat" Source="$(var.DriverFilesDir)\Driver\MyDriver.cat" /> 
     <File Id="MyDriver.inf" Source="$(var.DriverFilesDir)\Driver\MyDriver.inf" /> 
     <File Id="MyDriver.sys" Source="$(var.DriverFilesDir)\Driver\MyDriver.sys" KeyPath="yes" /> 
     <File Id="WdfCoinstaller01011.dll" Source="$(var.DriverFilesDir)\Driver\WdfCoinstaller01011.dll" /> 
     <difx:Driver AddRemovePrograms="no" Legacy="no" PlugAndPlayPrompt="no" Sequence='1' /> 
    </Component> 
</Feature> 

注意<difx:Driver>標籤識別它上面你的驅動程序組件,所以爲了做事情。更多信息here

您將需要更改Component標籤的目錄以匹配目錄結構中的某些內容,或者您​​可以在ApplicationProgramsFolder下添加<Directory Id="DriverFiles" Name="Drivers" />

File標籤的Source值使用預處理器變量DriverFilesDir,您可以用硬編碼路徑替換,或者您也可以將它設置在您的項目設置。在「構建」選項卡下,爲了「定義預處理器變量:」,您可以添加諸如DriverFilesDir=..\Drivers之類的內容。注意多個變量以分號分隔。

+0

我還沒有到處去嘗試這個功能的WiX。很高興聽到您已成功使用它!上次我安裝了驅動程序,我相信我用dpinst.exe來完成它。 –

+0

再次感謝!這是有道理的,我只有1個問題。這是什麼,這部分是完全 - >「$(var.DriverFilesDir) – Xanthius

+0

這是一個名爲'DriverFilesDir'的預處理器變量的引用,你可以在其中硬編碼一個路徑 – philselmer

相關問題