Richard Howells' Blog

‘Application’ is ambiguous in the namespace ‘Microsoft.Office.Interop.Excel’

I was trying to upgrade a VS2008 project to VS2012 – After upgrade I had the message ‘Application’ is ambiguous in the namespace ‘Microsoft.Office.Interop.Excel’

Back in the original VS2008 project there was a Warning message about unable to find an assembly.  It seemed to be related to Excel, but had not stopped the app working in years and had been ignored.  Deciding that the original complaint in VS2008 was probably the root cause of the ambiguity I set out to try and fix it.

Eventually I tracked it down.  The project had a COM reference to Excel and a .Net reference to the Excel Primary Interop Assembly.  I only discovered this by poking about in the vbproj file with a text editor.  I didn’t find a way of seeing, or removing, the COM reference through the VS UI.  Eventually I excised the entire COMReference node starting COMReference Include="Microsoft.Office.Interop.Excel" using the text editor.  Saved the project and all was well.  Back in VS2008 it built without the warning.  Converted to VS2012 it built without the ambiguity message.

Yahay!

 

Posting Archive
Copyright 2002-15 by Dynamisys Ltd