Use Ncryptoki dll from .NET 4.0 class library

1/10/2012 5:29:48 PM
Gravatar
Total Posts 22

Use Ncryptoki dll from .NET 4.0 class library

So im tryng to use the NCryptoki dll from class library but im receiving the error:

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

I know that for application u can add the 

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
</startup>

to the configuration, but since im running ir from class library i cant do that.

How can i get this working?

1/17/2012 11:38:00 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Use Ncryptoki dll from .NET 4.0 class library

How can you run a class library from another class library?

You have a class library that uses NCryptoki and you are running your class library from within an application.

In this case you should change the the .config of you application adding

<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
</startup>

1/19/2012 10:27:09 AM
Gravatar
Total Posts 22

Re: Use Ncryptoki dll from .NET 4.0 class library

1/19/2012 10:33:01 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Use Ncryptoki dll from .NET 4.0 class library

Really interesting.

Many thanks for your post!