問題描述
ClickOnce 部署,需要係統更新 Microsoft.mshtml (ClickOnce Deployment, system update required Microsoft.mshtml)
我們有一個與 MS Office 配合使用並使用 Microsoft.mshtml.dll 的應用程序。我們使用 ClickOnce 來部署應用程序。該應用程序在大多數機器上部署都沒有問題,但有時我們會收到錯誤消息“需要係統更新,Microsoft.mshtl.dll 應該在 GAC 中”。
我們嘗試安裝 PIA for Office,但沒有成功。由於 Microsoft.mshtml.dll 是一個系統相關文件,我們不能將它包含在包中並重新分發它。部署應用程序的最佳方式是什麼?
參考解法
方法 1:
Do you know which version of MS Office you are targeting? These PIAs are very specific to the version of Office. I remember when we were building a smart client application, we used to have Build VM machines, each one targeting a specific version of Outlook.
Another hurdle was not being able to specify these PIAs as pre‑requisites or bundle them with the app. These PIAs needs to be installed on the client using Office CD (at least for 2003 version).
方法 2:
You can set up prerequisites in a clickonce app, which would check for specific assemblies in the GAC before allowing users to install. You would still need to manually install an app that includes the required office dll outside of ClickOnce, but you would at least avoid throwing errors.
方法 3:
We are targeting Office 2003 and Office 2007, but using the Office 11 (2003) dlls as Office 2007 is backward compatible.
The problem occurs only for Microsoft.mshtml.dll file. This file is setup as a prerequisite in the ClickOnce app.
On this particular install we tried installing both the Office 2003 and Office 2007 PIA's to no avail.
方法 4:
I had this problem too.
The solution to this is to go to the References folder in the solution explorer, then right click Microsoft.mshtml, then Properties.
In the Propoerties page mark "Copy Local" as True. This should work.
(by moza、Gulzar Nazim、Guy Starbuck、moza、Karim Agha)