0

私は現在、社内開発 SDK のインストールを作成しています。この SDK の一部は、Visual Studio 2008 のガイダンス パッケージです (ガイダンス フレームワーク バージョン: 2008 年 2 月)。

残念ながら、作成されたガイダンス パッケージのWiXインストールを記述する方法がわかりません。どうやってするか?

既定では、Visual Studio のガイダンス パッケージ ウィザードは、Visual Studio 展開プロジェクトの作成のみをサポートします。これは役に立ちますか?

何をすべきかを見つけるために、展開プロジェクトを分析しようとしました。

  • 展開プロジェクトは、カスタム アクションを呼び出します。アクションの SourcePath は GuidanceInstaller.dll、CustomActionData は次のとおりです: /Configuration=”[TARGETDIR]Guidance.xml”,
  • GuidanceInstaller.dll は、Visual Studio パッケージ ウィザードによって作成されたプロジェクトの出力です。プロジェクトは 1 つのクラスのみで構成されます。

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

    すべてのインストール アクションが ManifestInstaller クラスに隠されているように思えますか?

  • Guidance.xml は、DflGuidance ウィザードによって作成される XML ファイルです。

この情報から WiX インストールを作成する方法は? 別のアイデアは大歓迎ですが!(私が考えていたのは、Visual Studio 展開プロジェクトから得られた msi/cab ファイルを WiX インストールに統合することでした。それは可能ですか?)

4

1 に答える 1

1

事前条件チェック

前提条件は、

  1. Visual Studio 2008 IDE のインストール。
  2. Dotnet Framework 2.0 ランタイム
  3. GAXのインストール。

これらを確認するには、次の 2 つの 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 -->

インストールフォルダ

ランタイム インストール フォルダーのセットアップを定義します。このリンクは、すべての「ハウツー」に答えるのに役立ちます。

インストーラーの実行

以下に示すように、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);
    }
}

この WIX インストーラーがないと、"RunInstaller" としてマークされているクラスがないという例外がスローされます。

この後、以下の WIX 要素を使用して 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>

お役に立てれば。

于 2010-02-19T11:15:55.813 に答える