2009-12-09 119 views
0

我目前正在爲我們的內部開發SDK編寫安裝。該SDK的一部分是Visual Studio 2008的指導包(指導框架版本:2008年2月)。WiX:如何使用WiX安裝指導自動化軟件包(GAT)?

不幸的是,我不知道如何爲創建的指導包編寫WiX安裝。怎麼做?

默認情況下,Visual Studio中的guidance-package-wizard僅支持創建Visual Studio部署項目。這可能有用嗎?

我已經試圖分析部署項目,以找出該怎麼做:

  • 部署項目需要的自定義操作。該操作的SourcePath是GuidanceInstaller.dll,CustomActionData是:/Configuration="[TARGETDIR]Guidance.xml「,
  • GuidanceInstaller.dll是Visual Studio軟件包嚮導創建的項目的輸出。該項目只包括一個類:

    using Microsoft.Practices.RecipeFramework; 
    
    [System.ComponentModel.ToolboxItem(false)] 
    public class InstallerClass : ManifestInstaller 
    { 
    } 
    

    似乎我認爲每個安裝操作都隱藏在ManifestInstaller類中?

  • Guidance.xml是由DflGuidance嚮導創建的XML文件。

如何從這些信息創建一個WiX安裝程序?儘管歡迎其他想法! (我想過是從我的維克斯 - 安裝Visual Studio的部署項目所產生的MSI/CAB文件整合,這可能嗎?)

回答

1

前提條件檢查

的先決條件是,

  1. Visual Studio 2008 IDE安裝。
  2. Dotnet Framework 2.0運行時間
  3. GAX安裝。

要檢查這些,引用這些兩個DLL:

  1. WixNetFxExtension(大多是從C:\ Program Files文件\的Windows Installer XML V3 \ BIN \ WixNetFxExtension.dll)
  2. WixUIExtension(主要是由C :\ Program Files文件\的Windows Installer XML V3 \ BIN \ WixUIExtension.dll)

,並如下圖所示添加先決條件,你.wxs文件。

<!-- Dotnet 2.0 framework installation check - START --> 
    <PropertyRef Id="NETFRAMEWORK20" /> 
    <Condition Message="Framework 2.0 is required for the setup to continue."><![CDATA[INSTALLED or NETFRAMEWORK20]]></Condition> 
    <!-- Dotnet 2.0 framework installation check - END --> 

    <!-- VS.NET and VS.C# installation check - START --> 
    <Property Id="VCSHARP"> 
    <RegistrySearch Id="VCShaprp" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\Microsoft Visual C#" Name="Package" Type="raw" /> 
    </Property> 
    <Condition Message="Please install Visual C# with Visual Studio 2008 to continue. Setup will now abort."><![CDATA[INSTALLED or VCSHARP]]></Condition> 
    <!-- VS.NET and VS.C# installation check - END --> 


    <!-- GAX for VS.2008 installation check - START --> 
    <Property Id="GAX"> 
    <RegistrySearch Id="gax" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\RecipeManagerPackage" Name="Package" Type="raw" /> 
    </Property> 
    <Condition Message="Please install Guidance Automation Extension on Visual Studio 2008 to continue. Setup will now abort."><![CDATA[INSTALLED OR GAX]]></Condition> 
    <!-- GAX for VS.2008 installation check - END --> 

    <!-- Pre-requisite check - END --> 

安裝文件夾

定義運行時安裝文件夾的設置。這link將幫助你回答你所有的「如何」。

運行安裝程序

你有如下修改InstallerClass。

[System.ComponentModel.ToolboxItem(false)] 
    [RunInstaller(true)] 
public class InstallerClass : ManifestInstaller 
{ 
    public InstallerClass() 
     : base() 
    { } 

    public override void Install(System.Collections.IDictionary stateSaver) 
    { 
     base.Install(stateSaver); 
    } 

    public override void Commit(System.Collections.IDictionary savedState) 
    { 
     base.Commit(savedState); 
    } 

    public override void Rollback(System.Collections.IDictionary savedState) 
    { 
     base.Rollback(savedState); 
    } 
} 

沒有這個維克斯安裝程序會拋出異常說不類被標記爲「runInstaller的」

這一點,你可以使用下面維克斯元素installutil.exe運行運行安裝程序類之後。

<InstallExecuteSequence> 
    <RemoveExistingProducts After="InstallInitialize" /> 
    <Custom Action="ManagedInstall" After="InstallFinalize" >NOT Installed</Custom> 
    <Custom Action="ManagedUnInstall" After="InstallInitialize">Installed AND NOT UPGRADINGPRODUCTCODE</Custom> 
    </InstallExecuteSequence> 

    <CustomAction Id="ManagedInstall" 
       Directory='INSTALLLOCATION' 
       ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false /DesignMode /hive=9.0 /Configuration=&quot;[INSTALLLOCATION]Guidance.xml&quot; &quot;[INSTALLLOCATION]PackageInstaller2008.dll&quot;' 
       Return='check' > 
    </CustomAction> 

    <CustomAction Id="ManagedUnInstall" 
       Directory='INSTALLLOCATION' 
       ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /u /LogToConsole=false /DesignMode /hive=9.0 /Configuration=&quot;[INSTALLLOCATION]Guidance.xml&quot; &quot;[INSTALLLOCATION]PackageInstaller2008.dll&quot;' 
       Return='check' > 
    </CustomAction> 

希望這會有所幫助。