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

Solution 1:

Every time it happend to me i just restarted visual studio, re-built the solution and it worked just fine.. can't say why

Solution 2:

In addition to the "does not exist in the namespace" message, I was also getting a message from the designer that it could not display the window for x64 and ARM targets.

I have just found that switching the build to x86 mode, doing a rebuild solution, then switching back to x64 mode and then rebuilding again fixes [both] problems.

Simply rebuilding the x64 solution did nothing.

Solution 3:

What I found that helped (especially if this error occurs in App.xaml) is to comment out the reference(s) that gives you trouble, rebuild, then uncomment. I think what this does is allows the entire project to actually build instead of stopping the build at the error.

From what I can gather, the app is trying to build the files in a certain order, so when App.xaml or presumably any other class file errors in a reference, the file that is causing the error hasn't been compiled correctly, hence why it doesn't find the file in that namespace.

Solution 4:

This is what worked for me on Visual Studio 2012 (Update 3).

  • Restart Visual Studio
  • Add current assembly to namespace declaration xmlns:framework="clr-namespace:TimeRecorder.Framework;assembly=MyAssembly
  • Build -> Build Solution

Solution 5:

Rebuild your solution (sometimes clean then build works better). Then look at your error list, scroll to the very bottom, and it will most likely indicate an error that is not allowing your assembly to compile, and the XAML compiler is most likely using a cached version of the assembly, not the new one you mean to build.