1

これはかなり簡単だと思いましたが、Microsoft.Deployment.WindowsInstaller の一部である PatchInstallation クラスの使用に問題があります。

正しいパッチ コードと製品コード (targetcode) を取得したので、IsInstalled プロパティを呼び出すだけですが、ArgumentNullExceptions がスローされます。

PatchInstallation patchInstallation = new PatchInstallation(patchCode.ToString("B"), productCode.ToString("B"));
return patchInstallation.IsInstalled;

例外テキストは次のとおりです。

System.ArgumentNullException が発生しました Message=Value を null にすることはできません。パラメータ名: String Source=mscorlib ParamName=String
StackTrace: at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) Microsoft.Deployment.WindowsInstaller.PatchInstallation.get_State() で Microsoft.Deployment.WindowsInstaller.PatchInstallation.get_IsInstalled() InnerException:

誰かが私が間違っていることを知っているなら、私に知らせてください! 乾杯!

4

1 に答える 1

1

パッチの状態を取得する前に、コンテキストを選択する必要があります。UserContext を受け取る 4 つの引数のコンストラクターを使用して、UserManaged、UserUnmanaged、または Machine のいずれかを選択します。

于 2012-11-28T15:32:42.267 に答える