BK.
BK.

Reputation: 395

How to run .NET 2.0 assembly in a .NET 4.0 applicaton

I have a .NET 4.0 web application that uses a .NET 2.0 assembly. I've added the reference to the 2.0 assembly and added this

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v2.0.50727" />
</startup>

in the web.config file. Problem is I still get a compile time error stating that I'm "missing an assembly reference". I've even decompiled the assembly and recompiled it in .NET 4.0, and still no luck.

Please assist?

Upvotes: 2

Views: 3259

Answers (2)

J. Tihon
J. Tihon

Reputation: 4459

Give this a try:

<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
</configuration>

Upvotes: 4

Matteo TeoMan Mangano
Matteo TeoMan Mangano

Reputation: 430

Framework 4.0 does not includes (as 3.5 previously did) the 2.0 framework.

First of all you must install also the 2.0 framework on your PC.

Upvotes: 2

Related Questions