Migrating from Old CAS-Based Code

If you move your existing code to .NET Framework 4.x and used Code Access Security policies, you might be advised with a message saying that CAS is obsolete. In these situations, you can add a specific section to the application configuration file, which allows legacy policies that look like this:

<configuration>  <runtime>    <NetFx40_LegacySecurityPolicy enabled="true"/>  </runtime></configuration>

Of course, you always need to check whether legacy policies are appropriate in the particular scenario you are facing. You are encouraged to read the MSDN documentation about CAS migration, available at http://msdn.microsoft.com/en-us/library/ee191568(v=vs.110).aspx.

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.