VS2013:查找资源字典时出错 [英] VS2013: An error occurred while finding the resource dictionary
问题描述
我刚拿到 VS2013 并打开了我的 VS2010 项目.但是现在我看不到任何 xaml 设计.问题是没有应用样式:
I just got VS2013 and opened my VS2010 project. However now I cannot see any of xaml designs. The problem is the Styles are not being applied:
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/Colors.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
给我错误:
错误 1 查找资源字典/Themes/Colors.xaml"时出错.
Error 1 An error occurred while finding the resource dictionary "/Themes/Colors.xaml".
这在 VS2010 中运行良好.构建选项设置为 Page.所有目标框架都设置为 .NET 4.
This works fine in VS2010. The build option is set to Page. All target frameworks are set to .NET 4.
目录结构是这样的:
Host\Themes\Colors.xaml
Plugins\EqPlugin\Source\ProblemFile.xaml
主题在 VEParameters 项目中定义并声明:
The themes are defined in the VEParameters project and have this declared:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EQPlugin;assembly=VEParameterTool">
发生错误的文件位于 EqPlugIn 目录中,并声明了以下内容:
The file where the error occurs is in the EqPlugIn directory and has this declared:
<UserControl x:Class="EQPlugin.EQControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:src="clr-namespace:VEParameterTool;assembly=VEParameterTool"
xmlns:l="clr-namespace:EQPlugin"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:oxy="http://oxyplot.codeplex.com"
mc:Ignorable="d">
我尝试将路径更改为相对路径,但这不起作用,我删除并重新添加了程序集,重新启动等,所有项目都是为同一个框架构建的.我不知道还能尝试什么.
I have tried changing the paths to relative paths but that doesn't work, i have removed and re-added the assemblies, i have restarted etc, all projects are build for the same framework. I don't know what else to try.
推荐答案
试试下面的一个,提供程序集名称,即使是在同一个程序集中
Try the below one, Provied the assembly name, even if it is in the same assembly
Source="pack://application:,,,/<assemblyName>;component/Themes/Colors.xaml"
这篇关于VS2013:查找资源字典时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!