且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设计器无法显示 XAML(未找到类型“本地:...")

更新时间:2022-10-16 11:01:06

我将继续回答我自己的问题,它可能会在未来帮助其他人.

找了好久才发现:

Visual Studio 不支持从不可靠的位置加载文件.

我已将该项目复制到网络存储磁盘,但它无法正常工作.一旦我将项目复制到本地磁盘,它就开始工作了.

My issue seems to be the exact same one as this question: "Unable to load the metadata" errors when loading a project But since it is not answered I will ask my own question.

I am using Microsft Visual C# 2010 Express to open a project. No errors at first but when I open an xaml file I get the following errors:

Error   4   The type 'local:IndexConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    MainWindow.xaml 19  26  AppInventoryMvvm
Error   5   The type 'local:EditResourceMultiParamConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.   MainWindow.xaml 39  26  AppInventoryMvvm
Error   6   The type 'local:AddResourceMultiParamConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    MainWindow.xaml 54  26  AppInventoryMvvm
Error   7   The type 'local:IndexConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    MainWindow.xaml 96  30  AppInventoryMvvm
Error   8   The type 'local:IndexConverter' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.    MainWindow.xaml 112 30  AppInventoryMvvm

As you can see all the errors look the same and the code where it is complaining looks like this:

<local:IndexConverter x:Key="IndexConverter" />

Now I am using the exact same version of IDE together with SP and so on as my other colleagues, (I am also opening the exact same project as them) it is a total mystery to me why I can view the design! any ideas?

To see the exact errors and code, please see the screen dump below:

I am going to go ahead and answer my own question, it might help other people in the future.

After a long time searching I found out that:

Visual Studio doesn't support loading files from unreliable locations.

I had copied the project to a network storage disk and it just would not work. As soon as I copied the project to a local disk it started working.