查找资源字典时出错 [英] An error occurred while finding the resource dictionary

查看:49
本文介绍了查找资源字典时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 App.xaml 主程序集中有一个合并的资源字典,它结合了来自不同程序集的各种资源字典:Common 和 PresentationLayer.

I have a merged resource dictionary in App.xaml Main assembly, which combines various resource dictionaries from separate assemblies: Common and PresentationLayer.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Common;component/Themes/Button.xaml"/>
            <ResourceDictionary Source="/PresentationLayer;component/DataTemplates/AppointmentsDataTemplates.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

在运行时,资源字典中的样式会正确应用于控件.但是,在设计时未应用样式并且 Visual Studio 2012 不断给出以下错误:

At run time the styles in the resource dictionaries are applied to the controls correctly. However, at design time the styles are not applied and Visual Studio 2012 keeps giving the following error:

An error occurred while finding the resource dictionary "/Common;component/Themes/Button.xaml".

和警告:

The resource "BannerButton" could not be resolved.

我遇到了这篇文章,但尽管构建操作设置为资源,但问题仍然存在.此外,我在 Visual Studio 2010 或 Expression Blend 4 下运行时没有遇到这个问题.主程序集肯定包含对公共程序集的引用,我没有更改包 URI.

I came across this post but the problem persists despite Build Action set to Resource. Also, I did not have this problem when running under Visual Studio 2010 or Expression Blend 4. The Main assembly definitely holds a reference to the Common assembly and I haven't changed the Pack URIs.

推荐答案

这是 Visual Studio 2012 的一个已知问题.请参阅 此链接 位于 Microsoft Connect.安装 VS2012 Update 1 后,这个问题为我解决了.如果您认为您运行的是最新版本的 VS2012 并且仍然遇到此问题,请务必确保已应用更新.我以为我已经使用 Windows Update 进行了更新,但后来发现我必须告诉 VS2012 应用更新.VS2012 完成后一切正常.

This was a known issue with Visual Studio 2012. See this link at Microsoft Connect. After installing VS2012 Update 1 this issue resolved for me. If you think you're running the most up to date version of VS2012 and still experiencing this issue, make absolutely sure that the update has been applied. I thought I had updated using Windows Update, but then found that I had to tell VS2012 to apply the update. After VS2012 did its thing everything was fine.

这篇关于查找资源字典时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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