2

I am having a weird problem with Visual Studio 2012, .NET 4.5 and WPF.

Views wont find references to any of my clases and I keep receiving the error "The name "..." does not exist in the namespace "clr-namespace" "

while intellisense do find any of my clases

What I've tried:

  • xmlns:common="clr-namespace:IVT.Common.View;assembly=IVT"
  • xmlns:common="clr-namespace:IVT.Common.View;assembly="
  • xmlns:common="clr-namespace:IVT.Common.View"
  • Moving my classes to other namespaces
  • I restarted visual studio and my computer
  • Changed the .NET version and the compilation method (x86/x64)
  • I created new projects and they have this problem now too... but old project still work...

EVERY time intellisense would find classes but visual studio still throws that error...

Any idea?

Thanks.

Rafa
  • 443
  • 5
  • 14
  • 2
    Did you hit build first? – Jeff Mercado Jul 26 '16 at 01:57
  • Can you check your project references in your solution explorer to see if the IVT reference has a yellow exclaimation mark? – failedprogramming Jul 26 '16 at 03:17
  • IVT is my project, and no yellow marks anywhere :( – Rafa Jul 26 '16 at 15:00
  • ... Intellisense in xaml files won't work for a new project until you build it the first time. It needs the assembly to be able to generate the completion lists... So I ask you again... did you hit build first? – Jeff Mercado Jul 26 '16 at 19:51
  • As I stated in my description... Intellisense in the XAML file works just fine... Meaning that yes I build it and rebuild it and cleaned it and build it again in whatever order You feel the need to ask... – Rafa Jul 27 '16 at 00:41
  • Did you check in the C# code that what you're trying to call is actually under that namespace? I've run into a similar issue where some of the files had been moved to a different directory within the project, but the classes themselves never changed the namespace at the top of the file. – Meloviz Jul 27 '16 at 14:08
  • yes, the namespaces are right :( .... I ended up moving stuff to the code behind.... – Rafa Jul 29 '16 at 23:05
  • What most bothers me is that old projects still work......... – Rafa Jul 29 '16 at 23:10

2 Answers2

1

Try changing the build target platform and rebuilding. It actually solved the problem for me.

  1. Change your current build target platform to the other one ie x64 if currently x86.
  2. Re-build the entire solution.
  3. Change back to required target platform ie x86 and re-build the solution.
ViVi
  • 4,339
  • 8
  • 29
  • 52
1

I had similar problem using VS Studio 2017

In order to reproduce the problem I Created a WPF project. Added a user control and referenced the control in the main window.

The problem I had was that my solution was on a file server and not locally on my computer. Moving it to local everything worked as expected. Not sure if this is a bug in VS Studio or not.

Ergodyne
  • 165
  • 1
  • 15