locked
Loading a dll in .Net 4.0 error [This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. RRS feed

  • Question

  • Hi!

    I am upgradeing a software i wrote to .Net 4.0. In this software i load some dlls like this:

    Assembly w = Assembly.LoadFrom(pluginDll, AppDomain.CurrentDomain.Evidence);

    but this method seems to be obsolete in 4.0 but i dont know how to change it to work with 4.0

     

    Any suggestions?

    Tuesday, December 6, 2011 9:04 AM

Answers

  • It’s important to note that although these APIs all take Evidence parameters, the concept of Evidence itself is not deprecated and continues to exist (and even enhanced in v4.0 – but that’s another show).  Evidence itself is still a useful tool for hosts to use when figuring out what grant sets they want to give assemblies.  The common thread with these APIs is that they used the Evidence to resolve against CAS policy – and it’s the CAS policy portion that’s been deprecated in v4.

    http://blogs.msdn.com/b/shawnfa/archive/2009/05/27/coding-with-security-policy-in-net-4-0-implicit-uses-of-cas-policy.aspx

    So base on this MSDN blog description, I think we just can enable the NetFx40_LegacySecurityPolicy to let the assembly use the legacy security police, then you can use the before overload methods.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Mike Dos Zhang Monday, December 12, 2011 9:26 AM
    Wednesday, December 7, 2011 4:38 AM

All replies

  • It’s important to note that although these APIs all take Evidence parameters, the concept of Evidence itself is not deprecated and continues to exist (and even enhanced in v4.0 – but that’s another show).  Evidence itself is still a useful tool for hosts to use when figuring out what grant sets they want to give assemblies.  The common thread with these APIs is that they used the Evidence to resolve against CAS policy – and it’s the CAS policy portion that’s been deprecated in v4.

    http://blogs.msdn.com/b/shawnfa/archive/2009/05/27/coding-with-security-policy-in-net-4-0-implicit-uses-of-cas-policy.aspx

    So base on this MSDN blog description, I think we just can enable the NetFx40_LegacySecurityPolicy to let the assembly use the legacy security police, then you can use the before overload methods.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Mike Dos Zhang Monday, December 12, 2011 9:26 AM
    Wednesday, December 7, 2011 4:38 AM
  • I am writing to check the status of the issue on your side. 
    What about this problem now? 
    Would you mind letting us know the result of the suggestions?

    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us
    Friday, December 9, 2011 7:34 AM