I have a user control C that is defined inside project P. C is present as a ".NET Framework Component" in my Visual Studio Toolbox. I open a form F (also defined inside project P) and drop C onto F.
Once I do that drop, Visual Studio adds a reference under P pointing to P's own DLL. This is unnecessary and causes tons of build errors like The call is ambiguous between the following methods or properties...
after which it lists the exact same method twice. If I go into References and delete the added reference, it builds correctly.
Can I prevent VS from adding this unnecessary reference?
Summary (By SLaks):
In VS2010, adding a UserControl to a form in the same project automatically adds a reference to the project itself, causing problems.
As far as I know this has been around at least since visual studio 2008. I tried finding a possible fix back then, but could not find one. Sorry, but I think you cannot prevent the unnecessary reference and have to remove it every time it does that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With