wpf Microsoft.Windows.Controls 您是否缺少程序集引用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16774750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 08:52:40  来源:igfitidea点击:

Microsoft.Windows.Controls are you missing an assembly reference?

c#wpfdll

提问by Ahmed AbdElkader Mahmoud

I'm receiving the following error:

我收到以下错误:

Error 26 The type or namespace name 'Controls' does not exist in the namespace 'Microsoft.Windows' (are you missing an assembly reference?)

错误 26 命名空间“Microsoft.Windows”中不存在类型或命名空间名称“Controls”(您是否缺少程序集引用?)

These two assemblies appear in the .g.cs file:

这两个程序集出现在 .g.cs 文件中:

using Microsoft.Windows.Controls;
using Microsoft.Windows.Controls.Primitives;

When I remove them, the error returns.

当我删除它们时,错误返回。

回答by Rafal

Check your XAML code. Probably there will be xmlnspointing Microsoft.Windows.Controls.Primitivesor Microsoft.Windows.Controls.

检查您的 XAML 代码。大概会有xmlns指点Microsoft.Windows.Controls.PrimitivesMicrosoft.Windows.Controls