[VSTO] warning CS0467 解决方案

warning CS0467: Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method group.

 

类似诸如:

warning CS0467: Ambiguity between method 'Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit'. Using method group.

warning CS0467: Ambiguity between method 'Microsoft.Office.Interop.Excel._Workbook.Activate()' and non-method 'Microsoft.Office.Interop.Excel.WorkbookEvents_Event.Activate'. Using method group.

 

解决办法:

Microsoft.Office.Interop.Word.Application 改成 Microsoft.Office.Interop.Word._Application

 

http://stackoverflow.com/questions/8303969/how-to-eliminate-warning-about-ambiguity

http://stackoverflow.com/questions/8640594/compile-time-warning-when-using-microsoft-office-interop-word-document-close

http://stackoverflow.com/questions/10480119/warning-cs0467-when-using-microsoft-office-interop-word-document-close

posted @ 2014-03-15 21:21  老鱼_678  阅读(1583)  评论(0编辑  收藏  举报