User123
User123

Reputation: 599

How do I resolve this multi project namespace issue?

I have 3 projects

  1. Company.Project
  2. Company.Project.Business (inside is Interfaces folder, that contains ISomeService)
  3. Company.Project.Web

In my SomeController I'm trying to do this:

private readonly Company.Project.Business.Interfaces.ISomeService _someService;

but i get this message

The type or namespace name 'Business' does not exist in the namespace 'Company.Project' (are you missing an assembly reference?)

I've imported the Company.Project.Business reference into my Web Project and added

using Company.Project.Business.Interfaces;

at the top of the SomeControlller class but I get the red squiggly under Business indicating that there is no Business class under Company.Project and that I should create it (which I don't need to do since I'm really just trying to use the project Company.Project.Business.

SOLVED: As @Tim mentioned, the Company.Project.Business wouldn't compile because I had duplicated class names during a bad merge get into its .csproj. Thank you once again @Tim!

Upvotes: 0

Views: 103

Answers (2)

User123
User123

Reputation: 599

As @Tim mentioned in the comments above, the Company.Project.Business wouldn't compile because I had duplicated class names during a bad merge get into its .csproj. Selecting his comment as the answer.

Upvotes: 0

Ricardo Smania
Ricardo Smania

Reputation: 3139

You add the reference to a project but inside the code you need to reference the namespace.

In your interface declaration how did you specify your namespace? It should be like this:

namespace Company.Project.Business.Interfaces

If you declare it only as Company.Project it won't work.

Upvotes: 1

Related Questions