我正试图制作一个程序来打开新的Outlook 2013消息。 我已经引用了Microsoft.Office.Interop.Outlook 15.0.0.0。发布模式下的Outlook互操作异常(E_NOINTERFACE)
在调试模式下运行一切工作正常,但在发行模式与异常崩溃:
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: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
代码:
var _Outlook = new MSOutlook.Application();
var _MailItem = _Outlook.CreateItem(MSOutlook.OlItemType.olMailItem) as MSOutlook.MailItem;
var _Recip = _MailItem.Recipients.Add("[email protected]");
Recip.Type = (int)MSOutlook.OlMailRecipientType.olTo;
_MailItem.Recipients.ResolveAll();
_MailItem.Subject = "xxx";
_MailItem.Display(false);
其中MSOutlook = Microsoft.Office.Interop.Outlook命名空间。
我正在使用.NET Framework 4.5和Outlook 2013.
Release模式对此有何影响?奇怪的调试模式工作正常..
我将不胜感激任何想法如何解决它。谢谢!
我已经尝试过的那一个,但可惜的是没有sucess :( – dontbyteme