Reputation: 3931
I am having some namespace issues. In my solution I have the following solutions ;
Services
Services.WebApi
Now, as an example in my WebApi controller I want to reference a sub namespace of the above Services solutions namespace, i.e.;
using Services.Data;
However, it is not resolving the Services from the project reference? Instead its trying to reference from a small namespace inside the Service.WebApi.Services of the current solution? So, it is looking like VS is automatically assuming the local namespace in stead of the referenced one? (i.e. if I hover over the Services text of Services.Data, intellisense is showing 'namespace Services.WebApi.Services'.
I've used this before with no issues, any ideas whats going on here?
To note the Services project is added as a reference and both are running .NET 4.6.
Upvotes: 0
Views: 36
Reputation: 7703
You can try using an alias for your Services
reference. In the References
List, select your Reference properties, And you'll see an Alias
property. Change in to the name you want and then change your using
to that name. Let's say you set the Alias to ExternalServices
. You'll need to add this to your code:
extern alias ExternalServices;
using ExternalServices::Services.Data;
That would solve your problem.
Upvotes: 0
Reputation: 239636
If you wish to indicate that your intention is to start at the "top" of the namespace hierarchy, you can use the global alias:
using global::Services.Data;
Upvotes: 1