I’m getting a compiler error saying that ‘Acme.Business.User’ is not defined.
I have a class library project called ‘Acme.Business’ that has ‘Acme.Business’ as the assembly name and root namespace as well. None of the classes use the ‘Namespace’ keyword, so they all should exist in the namespace ‘Acme.Business’.
I also have a class library project called ‘Acme.Web’ that has a project reference to ‘Acme.Business’. Again ‘Acme.Web’ is the project name, assembly name, and root namespace.
Here’s the weird part. If I add a class to ‘Acme.Web’ I can type ‘Imports Acme.’ at the top and see both namespaces appear in intellisense like you’d expect, but if I try to do ‘Dim x as New Acme.Business.User’ then ‘Business’ doesn’t show up in intellisense and I get an error saying ‘Acme.Business.User’ is not defined.
I can’t see what I’m doing wrong! Please help. Thanks.
OK, I figured out that the behavior I was seeing was because I was declaring namespaces within the code in Acme.Web the way I was used to in C# which is to fully qualify it, ie. Namespace Acme.Web.UI.WebControls. I didn’t realize that in VB.NET it’s building on top of what was specified for the root namespace. I removed the portion that was specified in the ‘root namespace’ setting of my project and it started working. So my namespaces in code for Acme.Web now look like Namespace UI.WebControls.