Testing an assembly built against 'v2.0.50727' of the runtime


I have a dll under test that would typlically use App.config from the exe that is using it. e.g. the app config has
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
This is because I am using System.Data.SQLite reference (runtime version 2.0.50727) in my assembly under test.

How this should be setup in the test dll so that the test pass.?

Right now I am not able to figure out a way to provide this so test fails:

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.

Have tried this approcah but not been successful


meghma wrote Mar 20, 2015 at 7:48 PM

meghma wrote Mar 26, 2015 at 5:51 PM

    static SQLiteHelperTests()
        bool policy = RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully;
in the test class constructor resolved the issue