简体   繁体   English

Vs2017:查找带有组件标签的资源字典时发生错误

[英]Vs2017: An Error Occured while finding the resource dictionary with component tagged

I'm having the same problem as this post, but already did the suggested correction and no luck: 我有与此帖子相同的问题,但已经做了建议的更正,没有运气:

Vs2017: An Error Occured while finding the resource dictionary Vs2017:查找资源字典时发生错误

My resource is like this 我的资源就是这样

<UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FIT.Windows.Forms;component/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>

But i can't preview the form: 但是我无法预览表格:

在此处输入图片说明

Exception Text: 例外文字:

An error occurred while finding the resource dictionary "pack://application:,,,/FIT.Windows.Forms;component/Themes/Generic.xaml". 查找资源字典“ pack:// application:,, // FIT.Windows.Forms; component / Themes / Generic.xaml”时发生错误。

Stack Trace : 堆栈跟踪 :

at Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders.ResourceDictionaryInstanceBuilder.ProvideResourceDictionary(ILocalInstanceBuilderContext context, ViewNode viewNode, IDocumentRoot& relatedRoot, ResourceDictionary& originalInstance) at Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders.ResourceDictionaryInstanceBuilder.UpdateProperty(ILocalInstanceBuilderContext context, ViewNode viewNode, IProperty propertyKey, DocumentNode valueNode) at Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders.ResourceDictionaryInstanceBuilder.InstantiateProperties(ILocalInstanceBuilderContext context, ViewNode viewNode, DocumentCompositeNode compositeNode) at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.DictionaryInstanceBuilder.Initialize(ILocalInstanceBuilderContext context, ViewNode viewNode, Boolean isNewInstance) at Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.LocalInstanceManager.InitializeInstance(IInstanceBuilder builder, Vi 在Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders.ResourceDictionaryInstanceBuilder.PropertyResourceDictionary。 ,Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders.ResourceDictionaryInstanceBuilder.InstantiateProperties(ILocalInstanceBuilderContext上下文,ViewNode viewNode,DocumentCompositeNode CompositeNode)上的DocumentNode valueNode)。 Microsoft.VisualStudio.DesignTools.Designer.InstanceBuilders.LocalInstanceManager.InitializeInstance(IInstanceBuilder builder builder,Vi)上的isNewInstance) ewNode viewNode, Boolean isNewInstance) ewNode viewNode,布尔值isNewInstance)

Thanks for your help. 谢谢你的帮助。

My solution came with a new solution file from sctrach. 我的解决方案来自sctrach的新解决方案文件。 That seem to do the trick. 这似乎可以解决问题。

For me this was a workaround: 对我来说,这是一种解决方法:

  1. Exclude the affected file from your project and include it back in 从项目中排除受影响的文件,然后将其重新包含
  2. Save and build solution 保存并构建解决方案

This works if the resource file worked before and is "randomly" not accessible anymore. 如果资源文件以前可以工作并且“不再”可以访问,则此方法有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM