Search code examples
c#namespaceslocalqualified

Fully Qualified Namespace on Local PC


Morning all. I'm a total noob at VS2022 and C#. I have created a class B in namespace A in a project that is on my local PC stored in C:\Users\un\source\repos\A. I want to reference class B in a new class in a different solution. How do I fully qualify the namespace A in a new class?

I've done a lot of googling but couldn't find an answer. Maybe I am using the wrong terminology.

EDIT: @user09938 The new class is in a different solution than namespace A.

Thank you!

I tried:

using B;

and got the error:

Error CS0246 The type or namespace name 'B' could not be found (are you missing a using directive or an assembly reference?


Solution

  • If class B is in a different project from class A, the project that contains class A will need to reference the project that contains class B (Solution Explorer, Dependencies, right-click, Add Project Reference...).