2017-12-15 21 views
0

私のアプリケーションIISversion> = 10をインストールしていないwixインストーラでこの問題が発生しました。これはIISVersionで動作します< 10.起動条件、カスタムアクション、およびプロパティ

このリンクをgithubで見つけました。 https://github.com/wixtoolset/issues/issues/5276 このリンクは、IISRegistryversionが> = IISRequiredVersionの場合にActionResult.Successを返すカスタムアクションを追加することを示唆しています。 しかし、次のエラーが発生しています。この後、ログにエラーが発生します 処置:LaunchConditions

アクション開始12:46:02:LaunchConditions。 変数が設定されていないか、カスタムアクションが呼び出されていません。 私はカスタムアクションにいくつかのログを記録していますが、冗長でも何も記録していません。

この条件が評価される前に起動条件/カスタムアクションが呼び出されていることを確認するにはどうすればよいですか?誰でもお薦めできますか?

enter image description here

これはProduct.wxsそれは条件なしで動作

<InstallExecuteSequence> 
    <Custom Action="CA.DS.CreateScriptDirCommand" Before="InstallFinalize"> 
     <![CDATA[NOT Installed AND (&Feature.DatabaseServer.Database = 3)]]> 
    </Custom> 
    <Custom Action="Iis.CheckInstalledVersion.SetProperty" Before="LaunchConditions" > 
     <![CDATA[NOT Installed AND &Feature.WebServer.WebServices = 3]]> 
    </Custom> 
    <Custom Action="Iis.CheckInstalledVersion" After="Iis.CheckInstalledVersion.SetProperty" > 
     <![CDATA[NOT Installed AND &Feature.WebServer.WebServices = 3]]> 
    </Custom> 
</InstallExecuteSequence> 
<Condition Message="This application requires IIS [Iis.RequiredVersion] or higher. Please run this installer again on a server with the correct IIS version."> 
    <![CDATA[Iis.IsRequiredVersion > 0]]> 
</Condition> 


<Fragment> 
    <CustomAction Id='Iis.CheckInstalledVersion.SetProperty' Property='Iis.CheckInstalledVersion' Execute='immediate' Value='' /> 
    <!--Note: Changed "Execute" from "deferred" to "immediate", to avoid error "LGHT0204: ICE77: Iis.CheckInstalledVersion is a in-script custom action. It must be sequenced in between the InstallInitialize action and the InstallFinalize action in the InstallExecuteSequence table"--> 
    <!--Note: Changed "Impersonate" from "no" to "yes", to avoid warning "LGHT1076: ICE68: Even though custom action 'Iis.CheckInstalledVersion' is marked to be elevated (with attribute msidbCustomActionTypeNoImpersonate), it will not be run with elevated privileges because it's not deferred (with attribute msidbCustomActionTypeInScript)"--> 
    <CustomAction Id='Iis.CheckInstalledVersion' BinaryKey='B.WixCA' DllEntry='CheckInstalledIISVersion' Execute='immediate' Return='check' Impersonate='yes' /> 
    <Component 
</Component> 
</Fragment> 


    [CustomAction] 
    public static ActionResult CheckInstalledIISVersion(Session session) 
    { 
     try 
     { 
      session.Log("* Starting to check installed IIS version"); 
      const int IisRequiredVersion = 7; 

      string IISMajorVersionFromRegistry = session["IISMAJORVERSION"]; 
      session.Log(string.Format("*!*! DEBUG; CheckInstalledIisVersion; IIS major version: {0}", IISMajorVersionFromRegistry)); 
      string iisMajorVersionNumeric = IISMajorVersionFromRegistry.Replace("#", string.Empty); 
      int iisMajorVersion = int.Parse(iisMajorVersionNumeric, CultureInfo.InvariantCulture); 

      bool isRequiredVersion = iisMajorVersion >= IisRequiredVersion; 

      // Setting the required version as a custom property, so that it can be used in the condition message 
      session["IIs.RequiredVersion"] = IisRequiredVersion.ToString(CultureInfo.InvariantCulture); 
      // Setting the results of the check as "bool" 
      session["Iis.IsRequiredVersion"] = isRequiredVersion ? "1" : "0"; 

      return ActionResult.Success; 
     } 
     catch (Exception ex) 
     { 
      session.Log(string.Format("CheckInstalledIisVersion; Error occured SC: {0}", ex.Message)); 
      return ActionResult.Failure; 
     } 
    } 

をどのように見えるかです。条件が実行される前に実行されます

答えて

1

フィーチャーチェックFeature.WebServer.WebServices = 3は機能しません。フィーチャーの「インストールする」状態は、原価計算後に設定され、ダイアログ)。したがって、CAは呼び出されていません。

これを再考して、CostFinalizeの後でIISのチェックを強制し、IISがインストールされていない/実行中でないことを警告する必要があるでしょう。したがって、IISを無条件で検索してプロパティを設定し、それは打ち上げ条件として。 & Feature.WebServer.WebServices = 3で、IISのバージョンが低すぎる場合は警告を出してください。

参照機能の動作条件のドキュメントとCostFinalizeの参照:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368012(v=vs.85).aspx

+0

興味深い!!。ありがとうございました。 – user575219

+0

セッション["Iis.IsRequiredVersion"] = isRequiredVersion? "1": "0"; Iis.IsRequiredVersionは '1'または '0'のいずれかになる可能性があるため、条件は&Feature.WebServer.WebServices = 3 AND Iis.IsRequiredVersion> '0'にする必要がありますか? &Feature.WebServer.WebServices = 3 AND Iis.IsRequiredVersion> 0である必要がありますか? – user575219

関連する問題