问题描述
当VS2019配置工程为x64模式时,打开工程中XAML
页面可能出现如下错误提示,进而无法正常显示XAML
设计界面。
There was an exception when loading the design time assembly 'C:\Users\Administrator\AppData\Local\Microsoft\VisualStudio\16.0_6b139390\Designer\ShadowCache\0ys5tt0n.gbn\2xcfs4nt.fbo\Design\Microsoft.Xaml.Behaviors.Design.dll': The type initializer for 'Targets' threw an exception.
解决方法
打开VS2019选项页面中的Enviroment
->Preview Features
,勾选其中的New WPF XAML Designer for .NET framework (requires restart)
,点击OK
按钮,重启VS2019问题即可解决。
`I found where was the problem.
It was related to Visual Studio 2019 settings.
Our projects are compiled for x64 mode and this was the reason why it didn’t work.
By default VS 2019 uses x86 WPF XAML Designer and you should go to Tools->Options, Environment->Preview Features.
And turn on New WPF XAML Designer.
This successfully fixed the problem.
相关链接
参考链接