关于visual studio 2010 此方法显式使用的 CAS 策略已被 .NET Framework 弃用 的问题
大家好,我在vs2010中使用了DevExpress组件,我在用Visual studio 2010从工具箱中向窗口拖动控件时显示如下提示:
创建组件“ToolTipController”失败。错误消息为:
“System.TypeInitializationException: “DevExpress.Utils.AppearanceObject”的类型初始值设定项引发异常。 ---> System.NotSupportedException: 此方法显式使用的 CAS 策略已被 .NET Framework 弃用。若要出于兼容性原因而启用 CAS 策略,请使用 NetFx40_LegacySecurityPolicy 配置开关。有关详细信息,请参见 http://go.microsoft.com/fwlink/?LinkID=155570。
在 System.Security.SecurityManager.ResolvePolicy(Evidence evidence)
在 DevExpress.Data.Helpers.SecurityHelper.IsPermissionGranted(IPermission permission)
在 DevExpress.Utils.Design.DXAssemblyResolverEx.Init()
在 DevExpress.Utils.AppearanceObject..cctor()
--- 内部异常堆栈跟踪的结尾 ---
在 DevExpress.Utils.ToolTipControllerShowEventArgs..ctor(Control control, Object obj, Object dummy)
在 DevExpress.Utils.ToolTipController..ctor()”
经上网查询,说是CAS(代码访问安全)在.net frame work 4.0中改了,不是像以前版本的framework那样了,就因为有这个限制拖动控件的时候才有这个警告,但是拖动System.Window.Form下原有的控件,比如按钮什么的是不会报错的,通过网上的意见我在程序的App.config中添加了如下的内容:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
不幸的是问题依旧啊,请问以前用过vs2010的,这个怎么解决啊,谢谢了,很急