c# - "Assembly is not referenced by this project"WPF资源字典错误

标签 c# .net wpf xaml resourcedictionary

创建一个名为:xmlnsError

的新 WPF 项目

添加对 PresentationFramework.Aero 的引用

将此 ResourceDictionary 添加到 App.xaml:

<ResourceDictionary Source="/PresentationFramework.Aero,Version=4.0.0.0,Culture=Neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL;component/themes/Aero.NormalColor.xaml"/>

这样做会显示警告

Assembly 'PresentationFramework.Aero,Version=4.0.0.0,Culture=Neutral,PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL' is not referenced by this project

我已通过导航到 C:\Windows 仔细检查以确保版本实际上是 4.0.0.0 并且 PublicKeyToken 实际上是 31bf3856ad364e35\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework.Aero 以及通过查看来自 AppDomain.CurrentDomain.GetAssemblies();

的 AssemblyInfo 在运行时检查 GAC

有什么办法可以解决这个警告吗?这是 WPF Windows 8 Compatability Issue 的后续问题

最佳答案

通常情况下,在使用程序集中的资源时不需要指定程序集版本、区域性和 key 。以下示例编译时没有任何警告:

<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>

关于c# - "Assembly is not referenced by this project"WPF资源字典错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22622717/

相关文章:

c# - 如何避免在 SQL Server 中将 HTML 实体转换为 html 形式 CAST(@ContentXml AS XML)

c# - 如何在 Regex 中指定匹配模式的优先级?

c# - 如何防止类被构建到发布 DLL 中?

c# - 单文件 ASPX 和 LINQ

c# - Master/Detail MVVM 中的 Wpf Combobox

wpf - 如何构建一个 Windows 应用程序来拦截击键和鼠标点击并将其传递给其他应用程序?

c# - 跨平台 Protobuf 序列化

c# - .NET 中的数值不一致

c# - .NET/C#/WPF 项目的命名约定

c# - 如何为 FlowDocumentScrollViewer 的自动滚动创建附加行为