C# 引用WP 8.0项目中WP 7.1项目中的ResourceDictionary

C# 引用WP 8.0项目中WP 7.1项目中的ResourceDictionary,c#,xaml,windows-phone-7.1,windows-phone-8,resourcedictionary,C#,Xaml,Windows Phone 7.1,Windows Phone 8,Resourcedictionary,我有一个Windows Phone类库项目(“WPLib”),目标是Windows Phone OS 7.1。在这个项目中,我有一个文件夹(“ResourceDictionaries”),其中包含一个资源字典(“ColorsAndBrushes.xaml”),内容如下: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns

我有一个Windows Phone类库项目(“WPLib”),目标是Windows Phone OS 7.1。在这个项目中,我有一个文件夹(“ResourceDictionaries”),其中包含一个资源字典(“ColorsAndBrushes.xaml”),内容如下:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/WPLib;component/ResourceDictionaries/ColorsAndBrushes.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

我有一个针对Windows Phone OS 8.0的Windows Phone应用程序项目,该项目引用了“WPLib”,并有一个自己的资源字典,其中包含以下内容:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</ResourceDictionary>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/WPLib;component/ResourceDictionaries/ColorsAndBrushes.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

这将导致以下错误:

在“Silverlight,Version=v4.0,Profile=WindowsPhone71”项目中定义的资源字典“/WPLib;组件/ResourceDictionaries/ColorsAndBrushes.xaml”不能用于“WindowsPhone,Version=v8.0”项目


除了添加原始资源字典作为WP8应用程序项目的链接之外,还有其他解决方法吗?(注意-类库必须始终以WP 7.1为目标)

查看可移植类库-这可能会有所帮助。@OndraMorský在我的PCL中,我无法通过UI或手动添加ResourceDictionary。