Click here to Skip to main content
15,848,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I was building an application under 2008 which worked OK.
Now, I was trying to migrate it into 2010 and I still receive errors relate to different ambiguous in namespace Microsoft.Office.Interop.Excel. This is refering to DataTable, Workbook, Worksheet, Application.

After few researches o the net about this error, it seems to be in 2008 and not due to migration.

Does anyone have any idea why it is happening.

Thanks a lot,
Updated 6-Sep-22 6:37am
Sandeep Mewara 30-Sep-12 14:00pm    
You talk of an error but don't share. How would anyone comment?
Sergey Alexandrovich Kryukov 30-Sep-12 14:07pm    
Well, I thing I can :-). I agree with you if you mean that the question is incomplete, but the general recommendation helps -- please see my answer.
ridoy 30-Sep-12 16:18pm    
As you are transferring your 2008 projects to 2010 then normally there will conflict between the namespaces of 2 versions for which it shows those ambiguous errors to respective dll files/namspaces

well, starting from your Sergey's solution, I was looking closely to the references and saw there are few other references to Office (different versions).

I just removed all of them and added the right one (Microsoft.Office.Interop.Excel) and it passed over this error.

...just hope this will help the future beginners as me and thank you all who spent some time to get a look on my question.
Share this answer
No, it is not ambiguous is you reference proper assembly. With Visual Studio, for example, you need to reference an assembly using the ".NET" tab of the "Add Reference" window. When you do it, you add the reference to the "interop" assembly for a specific Office version. You will see the reference in the list in this window.

Share this answer
Your Question is not clear.
but take a look here it may help full for you.
I had also face situation similar to this.
In my case "the error is an ambiguous reference between
System.Windows.Forms.Label and
actually both of these name spaces having same class name Label
when i create a variable of Label then system confuses what is meant by Label is it form ZedGraph or System.Windows.Forms.
i solve this problem by this.

using System.Windows.Forms;
using ZedGraph;
using zedLabel = ZedGraph.Label;
using Label = System.Windows.Forms.Label;  // here i am explicitly telling what i mean of Label so the System do not confuse with Other Object having same name in other namespace

when i want to create a object of type ZedGraph.Label then i use

ZedGraphLabel  Objec = new ZedGraphLabel()

if i create an object like this.
 // it creates a label of type System.Windows.Forms.Label;
Label l = new Label();

and an other way is this use complete reference . like this
Zedgraph.Label objLabel = new Zedgraph.Label();
System.Windows.Forms.Label objLabel2 = new System.Windows.Forms.Label();

I hope you understand..
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900