C# SystemColor缺少InactiveSelectionHighlightTextBrushKey

C# SystemColor缺少InactiveSelectionHighlightTextBrushKey,c#,wpf,xaml,systemcolors,C#,Wpf,Xaml,Systemcolors,在原型项目中编辑了ControlTemplate之后,我决定将自定义ControlTemplate移动到我的主项目中。这并没有像预期的那样开箱即用,Visual Studio通知我以下错误: 错误:在类型“SystemColor”上找不到静态成员“InactiveSelectionHighlightBrushKey” xaml源代码中没有突出显示和警告,因此不清楚出了什么问题。转到“inactiveselection highlightbrushkey”的定义,我在SystemColors成员列

在原型项目中编辑了
ControlTemplate
之后,我决定将自定义
ControlTemplate
移动到我的主项目中。这并没有像预期的那样开箱即用,Visual Studio通知我以下错误:

错误:在类型“SystemColor”上找不到静态成员“InactiveSelectionHighlightBrushKey”

xaml源代码中没有突出显示和警告,因此不清楚出了什么问题。转到“
inactiveselection highlightbrushkey
”的定义,我在
SystemColors
成员列表中没有看到条目:

我确实在原型项目的对象浏览器中找到了该成员。为什么SystemColor类在我的主项目中不完整?

基于此,我开始在框架版本中寻找差异

出于某种原因,即使该项目是TargetFramework,但在属性中将其设置为“.NET Framework 4.5.2”,PresentationFramework.dll和WindowsBase.dll的引用路径仍指向/v4.0路径。将属性中的目标从4.0更改为4.5.2没有效果。我不得不手动删除和添加引用

.csproj上的
git diff
显示以下更改:

-    <Reference Include="PresentationFramework">
-      <HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll</HintPath>
-    </Reference>
+    <Reference Include="PresentationFramework" />
-
-..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\..\程序文件(x86)\Reference Assembly\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll
-    
+    

WindowsBase.dll也是如此

您的目标是哪个框架版本?根据MSDN,在4.5中添加了is:@FlatEric.NET Framework 4.5.2