-1

In Visual Studio I have a bunch of error messages of the following type:

The name "X" does not exist in the namespace "Y".

I tried the solutions suggested here:

How do I fix error saying "The type or namespace name X does not exist in the namespace Y"?

and here:

the name <...> does not exist in the namespace clr-namespace <...>

Nothing worked.

Any ideas?

Tommy
  • 699
  • 4
  • 11
  • 26
  • If you are completely positive that your namespaces are correctly working together then restart visual studio and issue will be gone. Otherwise there is some wrong with your namespaces :) – Karolis Kajenas Sep 10 '17 at 15:47
  • that's one of the solutions I tried out ... it didn't work ... the thing is: the error messages occurred after I added (+ referenced) an existing project to my solution .... the error messages all refer to namespaces mentioned in one of the xaml-files of the new (added) project ... BUT: I know that the namespaces are correct because before including the project into my solution I ran it separately and everything worked fine ... – Tommy Sep 10 '17 at 15:53
  • ... so to summarize: the compiler does find the stuff in the namespaces when the project is run as standalone-project ... after adding and referencing the project to another project, the compiler is telling me that the namespaces do not contain the stuff they are supposed to contain – Tommy Sep 10 '17 at 15:56

1 Answers1

0

You need to specify the name of the project (assembly) where the types are defined in the namespace mapping (assembly=NameOfTheProject):

xmlns:local="clr-namespace:YourNamespace;assembly=NameOfTheProject"
mm8
  • 163,881
  • 10
  • 57
  • 88
  • I'm experiencing the same issue on a hello world program, and specifying the assembly name is causing the program to fail to build even though there is only a single assembly in the whole project. Is there any way to troubleshoot this? – RAM Dec 01 '22 at 23:06