问题:
To prevent possible data loss before loading the designer, the following errors must be resolved:
This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
我拔VS2005的代码在VS2010中编译的时候出现这个错误,主界面不能加载弹出这个错误,后来发现是调用了DevExpress 控件的原因,所以根据错误提示找到解决方案如下:
http://msdn.microsoft.com/zh-cn/library/ee191568(v=vs.110).aspx
方法一:迁移,替换已经过时的调用。这个具体方法细看网页中的帮助文档。
方法二:兼容性,使用CAS策略旧版选项。
使用 <NetFx40_LegacySecurityPolicy> 配置元素可指定进程或库使用旧版 CAS 策略。 启用此元素后,策略和证据重载将像在之前的 Framework 版本中一样工作。
说明 |
---|
CAS 策略行为是基于运行时版本指定的,因此修改某个运行时版本的 CAS 策略不会影响其他版本的 CAS 策略。 |
<configuration> <runtime> <NetFx40_LegacySecurityPolicy enabled="true"/> </runtime> </configuration>
Just add this
<NetFx40_LegacySecurityPolicy enabled="true"/>
into your VS2010 DevEnv configuration file, you'll find it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
There is a <runtime>
section, just copy it at the first place.
I've had the same problem with DevExpress 8.2
If some people face the same problem while developing ASP.Net apps, they should add the Attribute to the Cassini config file placed in C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.exe.config