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

前端 未结 25 1017
名媛妹妹
名媛妹妹 2020-11-28 04:59

I have a small WPF application which used to compile just fine but is not anymore. I can\'t really say at which point it stopped building. It just worked fine one day, and t

相关标签:
25条回答
  • 2020-11-28 05:52

    The problem is that when you create the x86 target, the output path for the particular project is set to bin\x86\Debug. It looks like Expression blend doesn't like this at all. It seems to only interested in whats in bin\Debug.

    If you changed your output path(s) for the x86 project to bin\debug for example, then I'm sure you'd find it will work. Well, works for me anyway :)

    0 讨论(0)
  • 2020-11-28 05:53

    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.

    0 讨论(0)
  • 2020-11-28 05:54

    What worked for me: - Switch solution configuration from Debug to Release - Switch back configuration from Release to Debug

    0 讨论(0)
  • 2020-11-28 05:54

    I Changed Target Framework My Application of ".Net Framework 4.5" to ".Net Framework 4.6" and it worked!

    0 讨论(0)
  • 2020-11-28 05:54

    I faced the same issue when i was trying to call the namespace in xaml. was showing that class is not available in the namespace. I searched a lot. Finally i found this issue was with VS. I am using VS 2013. I tried below steps:

    1. Build-->Configuration Manager--> Active Solution Platform --> Changed to x64 and x86 and Any CPU.
    2. Closed the VS and opened again.
    3. Change

      xmlns:VM="clr-namespace:MyFirstAppViewModel"
      

      to

      xmlns:VM="clr-namespace:MyFirstAppViewModel;assembly=ViewModel"
      
    0 讨论(0)
  • 2020-11-28 05:55

    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.

    0 讨论(0)
提交回复
热议问题