解决方案中的错误消息问题

时间:2011-04-29 12:29:11

标签: c# .net compilation

我有大约10个项目的解决方案,我自己没有写过任何这个,但我将在这里接管一个项目。作为主要项目的项目基于WPF。当我尝试运行此项目时,我收到以下编译器错误:

The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient

然后,如果我双击此错误消息,以便打开xaml,并且设计器已加载,则设计器不会加载,我还会收到3条错误消息:

Unable to load the metadata for assembly 'WsaClient'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'WsaClient' or one of its dependencies. The system cannot find the file specified. C:\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient

Unable to load the metadata for assembly 'RoutingManager'. This assembly may have been downloaded from the web. See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered during load: Could not load file or assembly 'RoutingManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. C:\Steria\Forsvaret\P6088\Source\WSA\WsaClient\Views\MainView.xaml 1 1 WsaClient

The type 'Views:RoutingManagerView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient

我用谷歌搜索了,很多人都认为这是因为DLL是因为它来自互联网而被锁定。但在我的情况下,我没有DLL。它抱怨两个项目是解决方案的一部分,WsaManager和RoutingManager。我在usb笔上的zip文件中获得了所有源代码,并将其解压缩到我的驱动器上的某个位置,因此无法远程访问代码。

如果有人之前遇到过相同或类似的问题,我将非常感谢此处有关如何解决此问题的任何指示。

修改

XAML文件中此行给出了最后一条错误消息:

<Views:RoutingManagerView DataContext="{Binding Dependency}"/> 

在XAML文件的顶部,这是程序集的导入:

xmlns:Views="clr-namespace:RoutingManager.Views;assembly=RoutingManager"

6 个答案:

答案 0 :(得分:6)

右键单击解决方案并选择“Rebuild Solution”

来解决此问题

答案 1 :(得分:3)

其他读者的另一点:如果您的项目成功构建,但在尝试在设计器中加载视图时收到此错误消息,请确保您的程序集是x86或任何CPU,因为Visual Studio 2010是32位进程并且无法在设计器中加载x64程序集。

答案 2 :(得分:2)

要解决这个问题,我必须逐个编译项目,从项目开始,不依赖于其他项目,然后以“up”方式工作。

似乎Build all无法自动正确地执行此操作。

答案 3 :(得分:2)

  

无法加载程序集“WsaClient”的元数据。这个集会   可能已从网上下载。看到   http://go.microsoft.com/fwlink/?LinkId=179545。以下错误是   加载期间遇到:无法加载文件或程序集'WsaClient'   或其中一个依赖项。该系统找不到指定的文件。   C:\ Source \ WSA \ WsaClient \ Views \ MainView.xaml 1 1 WsaClient

我遇到了同样的错误:我可以构建并运行我的项目,但我无法设计XAML。我意识到这是本地配置问题,因为它不能在我的其他机器上复制(使用相同的存储库修订版)。

我开始挖掘更多,并发现VS 2010不喜欢路径中的#符号。因此,当我在

中有我的来源时会出现错误
C:\#projects\<my project>

我把它们移到

之后
C:\projects\<my project>

问题已经消失。

我希望这对其他人有帮助。

答案 4 :(得分:2)

试试这个,这是唯一对我有用的建议:

无法加载程序集''的元数据。该程序集可能已从Web下载。见http://go.microsoft.com/fwlink/?LinkId=179545。加载期间遇到以下错误:无法加载文件或程序集''或其依赖项之一。不支持操作。 (HRESULT异常:0x80131515)

在允许项目从远程源加载的WPF项目中,我们必须在配置文件devenv.exe.config中启用它。

步骤1:在系统中搜索配置文件devenv.exe.config。通常它位于

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config

步骤2:编辑配置文件。在标记中添加以下行

<loadFromRemoteSources enabled="true" />

第3步:重新启动视觉工作室。

http://exacthelp.blogspot.cz/2012/02/unable-to-load-metadata-for-assembly.html

答案 5 :(得分:0)

我怀疑......

The tag 'RoutingManagerView' does not exist in XML namespace 'clr-namespace:RoutingManager.Views;assembly=RoutingManager'. Line 29 Position 14. C:\Source\WSA\WsaClient\Views\MainView.xaml 29 14 WsaClient

..错误导致一连串其他错误。您似乎正在尝试从程序集RoutingManagerView中的命名空间RoutingManager.Views创建RoutingManager。但是,它不在那里。确保课程对外界可见。或者尝试清理并重建解决方案,并查看第一个错误发生在哪个项目上。因为如果项目是相互依赖的,那么一个项目中的错误可能会导致其他项目中的参考错误。