我正在開發我正在開發的VSTO Outlook加載項,我有點奇怪的問題。它在一堆機器上工作正常,但在一個它引發InvalidCastException並找不到原因。我已經檢查過,所有的先決條件都安裝在這臺機器上(安裝程序本身就是這樣做的,但我也是手動檢查過的),並且所有內容似乎都與其他機器完全相同。VSTO加載項中的InvalidCastException
拋出異常的代碼是:
this.Application.Session.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).Items.
OfType<Outlook.AppointmentItem>();
和例外是:
Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).
沒有人有可能是什麼問題,什麼想法嗎?