为什么我在本地项目中不断收到“必须为不属于项目一部分的 XAML 文件指定程序集"错误? [英] Why do I keep getting 'Assembly must be specified for XAML files that are not part of a project' errors in a local project?

查看:23
本文介绍了为什么我在本地项目中不断收到“必须为不属于项目一部分的 XAML 文件指定程序集"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想强调的是,我确实知道如何在我的 XAML 文件中正确定义 XML 命名空间.这个重复的错误不是由我的代码中的错误引起的.该问题不会阻止我的项目成功构建或运行,并且提到的 Converter 类可以完美运行.

To start with, I would like to stress that I do know how to define XML Namespaces correctly in my XAML files. This repeated error is not caused by an mistake in my code. The problem does not stop my project from being built successfully, or running and the mentioned Converter class works perfectly.

当我构建项目时,错误消失了.但是,设计器显示了熟悉的错误消息:

When I build the project, the errors disappear. However, the designer show the familiar error message:

当我单击重新加载设计器"链接时,错误返回.这个问题最糟糕的部分是我失去了对这些视图的所有智能感知.

When I click on the 'Reload the designer' link, the errors return. The worst part of this problem is that I lose all Intellisense on these views.

错误突出显示了这些命名空间:

The error highlights these namespaces:

但是您可以清楚地看到它们已被正确声明:

But you can clearly see that they have been declared correctly:

我确信我之前已经找到了解决此问题的方法,但经过刚才的广泛搜索,我只能找到一百万个与此错误相关的帖子,而用户实际上犯了错误.另请注意,这是一个全新的 WPF 应用程序,不是从互联网或网络驱动器下载.

I'm sure that I have found a solution for this problem before, but after an extensive search just now, I can only find a million posts relating to this error where users have actually made errors. Please also note that this was a brand new WPF Application and not downloaded from the internet or a network drive.

推荐答案

项目是否在网络驱动器上?XAML 存在存储在网络驱动器上的项目的问题.在公司环境中,您的文档通常会重新映射到网络路径,从而导致默认项目文件夹出现此问题.

Is the project ON a network drive? XAML has issues with projects stored on a network drive. In corporate environments your Documents are often remapped to a network path, causing this problem for the default project folder.

试试像 c:\projects\yourprojecthere 一样?

Try like c:\projects\yourprojecthere instead?

网络上的 WPF 项目与 clr-namespace 共享

这篇关于为什么我在本地项目中不断收到“必须为不属于项目一部分的 XAML 文件指定程序集"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆