问题
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.
- Change your current build target platform to the other one ie x64 if currently x86.
- Re-build the entire solution.
- 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