wpf 来自程序集的类型是用旧版本的 blend sdk 构建的,在 windows 演示基础 4 项目中不受支持
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32024034/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
the type from assembly is built with an older version of blend sdk and is not supported in a windows presentation foundation 4 project
提问by Domysee
I created a WPF project in VS 2013. After upgrading to VS 2015, this error showed in the designer on types derived from the Blend SDK:
我在 VS 2013 中创建了一个 WPF 项目。升级到 VS 2015 后,此错误在设计器中显示在从 Blend SDK 派生的类型上:
the type from assembly is built with an older version of blend sdk and is not supported in a windows presentation foundation 4 project
来自程序集的类型是用旧版本的 blend sdk 构建的,在 windows 演示基础 4 项目中不受支持
回答by Irineu Licks Filho
Run Command Prompt as Administrator
Change Directory to Blend SDK:
cd C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Libraries\Register DLL:
gacutil -i System.Windows.Interactivity.dllRestart Visual Studio
以管理员身份运行命令提示符
将目录更改为 Blend SDK:
cd C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.5\Libraries\注册DLL:
gacutil -i System.Windows.Interactivity.dll重新启动 Visual Studio
参考:https: //connect.microsoft.com/VisualStudio/feedback/details/755407/xaml-designer-will-not-display-when-using-blend-sdk-behaviors
回答by Domysee
You can resolve this issue by manually changing the version numbers in .sln and .csproj files.
您可以通过手动更改 .sln 和 .csproj 文件中的版本号来解决此问题。
In .csproj and .csproj.user
change ToolsVersionto your current Visual Studio version. VS 2013 is version 12, VS 2015 is version 14.
在 .csproj 和 .csproj.user 中更改ToolsVersion为您当前的 Visual Studio 版本。VS 2013 是版本 12,VS 2015 是版本 14。
In .sln change VisualStudioVersionto the current version, you can find it in the About window.
在 .sln 更改VisualStudioVersion为当前版本,您可以在关于窗口中找到它。
Also change Microsoft Visual Studio Solution File, Format Versionto your current version (eg 14.00, 12.00)
同时更改Microsoft Visual Studio Solution File, Format Version为您当前的版本(例如 14.00、12.00)
Note:This only works for built-in assemblies. If external dependencies (like Prism) cause this error, you'd have to recompile them using the new Blend SDK. You could also try to update the dependency, maybe the newest version is already compiled using the latest Blend SDK.
注意:这仅适用于内置程序集。如果外部依赖项(如 Prism)导致此错误,您必须使用新的 Blend SDK 重新编译它们。您也可以尝试更新依赖项,也许最新版本已经使用最新的 Blend SDK 编译。
回答by Terrence
None of the other answers here worked for me. What finally solved it was deleting the .NET v4.0 version of the file in the SDK folder:
这里的其他答案都不适合我。最终解决的是删除 SDK 文件夹中文件的 .NET v4.0 版本:
C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\
I am referencing the v4.5 file via NuGet, but it seems that the designerwas finding the file in the above folder. The v4.0 file was not registered in the GAC.
我正在通过 NuGet 引用 v4.5 文件,但似乎设计者在上述文件夹中找到了该文件。v4.0 文件未在 GAC 中注册。
回答by Ryan Roos
Was having a similar problem using Visual Studio 2017 but none of the answers above fully resolved it for me. Found a Microsoft developer community pagethat had a workaround that did the trick. Comment by Bran Hagger recommended deleting the .vsfolder from the solution's directory. This additional step cleared out the cache and caused Visual Studio to rebuild it.
在使用 Visual Studio 2017 时遇到了类似的问题,但上述答案都没有为我完全解决。找到了一个 Microsoft 开发人员社区页面,其中有一个解决方法可以解决问题。Bran Hagger 的评论建议.vs从解决方案目录中删除该文件夹。这个额外的步骤清除了缓存并导致 Visual Studio 重建它。
回答by skst
The popular answer is valid, but since things are always changing in the developer world, I thought I would note that there's a (IMO) better solution now.
流行的答案是有效的,但由于开发人员世界中的事情总是在变化,我想我会注意到现在有一个(IMO)更好的解决方案。
In December 2018, Microsoft released an official, open source, supported NuGet package for XAML behaviors for WPF. (There's a separate one for UWP.) It's very easy to migrate to this package. You need to uninstall your current NuGet package, remove a couple of references, install this package, and change a using statement (or FQN).
2018 年 12 月,微软发布了一个官方的、开源的、支持 WPF XAML 行为的 NuGet 包。(UWP 有一个单独的。)迁移到这个包非常容易。您需要卸载当前的 NuGet 包,删除几个引用,安装此包,并更改 using 语句(或 FQN)。
https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Wpf/
https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Wpf/
https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/
https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/
I read about it in this SO answer, so credit goes to that OP:
我在这个 SO answer 中读到了它,所以归功于那个 OP:
回答by ARUN MOHANAN
Deleting the .vs file in the solution folder solved the issue. The issue happened for me after I updated My Visual Studio 2017 and Opened the project that was built before with an older version of Visual studio 2017.
删除解决方案文件夹中的 .vs 文件解决了该问题。在我更新了我的 Visual Studio 2017 并打开了之前使用旧版本的 Visual Studio 2017 构建的项目后,这个问题发生在我身上。
回答by hillin
This also could be that you are mixing different versions of System.Windows.Interactivity.dll, especially if you are getting the SDK from nuget where several different packages provide it, e.g.:
这也可能是您混合了不同版本的System.Windows.Interactivity.dll,特别是如果您从 nuget 获取 SDK,其中几个不同的包提供它,例如:
https://www.nuget.org/packages/Expression.Blend.Sdk/https://www.nuget.org/packages/System.Windows.Interactivity.WPF/
https://www.nuget.org/packages/Expression.Blend.Sdk/ https://www.nuget.org/packages/System.Windows.Interactivity.WPF/
In this case, you'll have to synchronize these libraries among projects.
在这种情况下,您必须在项目之间同步这些库。
回答by rmdev
Just the Microsoft Visual Studio Solution File, Format Version change to 14.00 worked for me.
只是 Microsoft Visual Studio 解决方案文件,格式版本更改为 14.00 对我有用。

![从后面的代码中添加组合框项目。[WPF]](/res/img/loading.gif)