Geeks With Blogs

News

Agha Usman Ahmed JILAWATAN

From the last few days, I was ignoring an error that keep coming at the compile time. I spent some two hours on it before but didn’t get it work. The error is quit confusing and of course difficult to manage.

'ApplicationSettingsBase' is ambiguous in the namespace 'System.Configuration'

'MailMessage' is ambiguous in the namespace 'System.Net.Mail'

And there are couple of other similar errors that is pointing to some ambiguous references in my project.  The confusing part is that the MailMessage object throws similar error when you are importing the old and new email namespace.

For example,

Imports System.Web.Mail
Imports System.Net.Mail

So if you are only encountering ambiguous problem in MailMessage object. It is more possible that you have define both the namespaces in your code behind which is actually confusing the compiler about your referencing object.

The quick solve for this problem is that remove Imports System.Web.Mail and it should work smooth. But with me, I never used the old asp.net mail namespace in my project.

Then I start looking at my references and luckily I found the problem there. Follow the steps below to investigate the issue

1. Go to your project

2. Then references

3. Right click on “System” and see properties. it should point to the following path

x:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll

Where x is name of your operating system directory. This was the problem with my project. I had my operating system install on “D” drive and some how it is pointing to “C” drive which is the root cause of this problem.

After that I verify all my references and found 5 –6 assemblies that are pointing to wrong path and get it worked.

Also note, the problem can occur in any type of project either it is website , web application etc.

Posted on Monday, February 28, 2011 4:05 AM | Back to top


Comments on this post: Ambiguous in the namespace problem

# re: Ambiguous in the namespace problem
Requesting Gravatar...
Impressive. A new plant in this time of difficulty is something you can be proud of. It is a good achievement and it is worth celebrating. - Randall Alifano
Left by Randall Alifano on Jan 06, 2012 4:46 PM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
This Really Really Help Thanks!
Left by Blake Da' Snake on Apr 12, 2012 8:08 AM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
Great. That helps a lot.
Left by SAURABH on Apr 22, 2012 5:57 PM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
Wow! Thank you! I am luck to find this :) I never have to spend my time looking for a solution over the net all day :) Thank you so much! :D
Left by Blues on Dec 17, 2012 2:22 PM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
I didn't have the same situation you did,but your post helped me resolve my issue as well.

I upgraded a .NET 2005 to a .NET 2010. For some reason, my System.dll still pointed at 2.0, even after changing the Target Framework to 4.0. I removed the reference and re-added the 4.0 reference and that solved the problem.
Left by Dave on Feb 19, 2013 7:37 AM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
Nice, Thanks!
Left by Howie on Aug 07, 2013 9:24 AM

# re: Ambiguous in the namespace problem
Requesting Gravatar...
thanks!solved my problem!
Left by sg on Mar 11, 2015 1:30 PM

Your comment:
 (will show your gravatar)


Copyright © Agha Usman Ahmed | Powered by: GeeksWithBlogs.net