私は clickonce アプリケーションを持っていますが、要件の 1 つは、アプリケーションが実行中であってもアプリケーションをアンインストールすることです。そこで、clickonce アプリのインストール、レジストリの更新などを行い、clickonce アプリのアンインストールにも使用する MSI ラッパーを作成しました。
プロジェクトの構造
- ClickOnce アプリケーション - サーバーhttp://someserver/app.client.applicationにデプロイされます。
- コンソール アプリケーション 1
- これにより、MSI のインストール中に上記の URL を呼び出すプロセスが起動します
- MSI のアンインストール中に、clickonce アプリが実行されている場合、アプリが閉じられるか、強制終了されます。clickonce アンインストール文字列が読み取られ、clickonce アプリをアンインストールしようとするプロセスが起動します。
- インストール中にイベントログ ソースを作成し、アンインストール中に同じものを削除するコンソール アプリケーション 2
- MSI ラッパー - clickonce アプリケーションのインストールとアンインストールに使用されます。
これにはカスタム アクションが設定されています
- Install
* Primary output from console Application 2
* Primary output from console Application 1
- Uninstall
* Primary output from console Application 1
* Primary output from console Application 2
コンソール アプリケーション 1 と 2 は、インストーラーの BeforeInstall イベントと AfterInstall イベントにフックします。
インストール中にすべて正常に動作し、イベント ログ ソースが作成され、clickonce アプリケーションが起動してインストールされます。インストール部分はスムーズに実行され、問題はありません。
しかし、アンインストール中に問題が発生しました.MSIはそれ自体をアンインストールし、クリックワンスをアンインストールするプロセスを呼び出し、プロンプトをスローしてイベントログソースを削除します.
エラー詳細はこちら
「アプリケーションのアンインストールに失敗しました」というポップアップが表示されます。詳細については、詳細を参照してください。
詳細ボタンをクリックすると、エラーの詳細テキストが開きます
PLATFORM VERSION INFO
Windows : 6.1.7600.0 (Win32NT)
Common Language Runtime : 4.0.30319.239
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.239 (RTMGDR.030319-2300)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
IDENTITIES
Deployment Identity : XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Error occurred during store lookup, component store may have been corrupted. Following failure messages were detected:
+ Application is not installed.
* Error occurred during uninstall of the application. Following failure messages were detected:
+ Application is not installed.
* Exception occurred during uninstall of application XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil. Following failure messages were detected:
+ Shortcut removal could not be completed. Publisher or product value is not valid.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [4/17/2012 10:52:36 AM] : Looking up information from component store.
* [4/17/2012 10:52:36 AM] : Uninstall of application XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil did not succeed.
ERROR DETAILS
Following errors were detected during this operation.
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (SubscriptionState)
- Application is not installed.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.SubscriptionStore.CheckInstalled(SubscriptionState subState)
at System.Deployment.Application.SubscriptionStore.CheckInstalledAndShellVisible(SubscriptionState subState)
at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (SubscriptionState)
- Application is not installed.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.SubscriptionStore.CheckInstalled(SubscriptionState subState)
at System.Deployment.Application.SubscriptionStore.UninstallSubscription(SubscriptionState subState)
at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (Subscription)
- Shortcut removal could not be completed. Publisher or product value is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ShellExposure.RemoveSubscriptionShellExposure(SubscriptionState subState)
at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
私は多くのアプローチを試しましたが、何もうまくいかないようです
- レジストリからアンインストール文字列を読み取り、プロセスを起動します。
- vbsript を作成し、カスタム アクションとして追加します。(objShell.Run "rundll32.exe dfshim.dll,ShArpMaintain XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil")
- cmd/bat ファイル (rundll32.exe dfshim.dll、ShArpMaintain XXXXX.Client.application、Culture=neutral、PublicKeyToken=0000000000000000、processorArchitecture=msil を含む) を作成し、アンインストール中に起動します。
3 つのアプローチはすべて同じエラーをスローします。しかし、それらを個別に実行すると、すべてが機能するようです。私はこれを2日以上試して、すべての髪を引き抜いています.