The name “…” does not exist in the namespace “clr-namespace”

久未见 提交于 2020-01-11 10:22:49

问题


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.


回答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.



回答2:


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.



来源:https://stackoverflow.com/questions/38579936/the-name-does-not-exist-in-the-namespace-clr-namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!