5

The Top answers here: What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config? and What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project? did not help.

My particular Use-case is .Net 4.5 and above for WinForms and Console apps in VS2015, while trying to use a .net 2.0 dll

Under VS2015, adding the suggested variants of this to projects config file does not help.

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

EDIT:

The .net 2.0 library depends on an external, non-dotnet dll.

In .net 4.0 client mode and .net 4.0 Full mode it works as expected.

But for .net 4.5 and above the functionality in that library stops working, even though the application starts up.

Community
  • 1
  • 1
Charles Okwuagwu
  • 10,538
  • 16
  • 87
  • 157
  • @leppie this is a VS2015 issue, and isn't it mixed-mode related? – Charles Okwuagwu Apr 07 '16 at 19:44
  • It has nothing to do with VS. It is .NET runtime. Mixed-mode is related to assemblies with native and managed code. You might actually want to describe what does not work, and what goes wrong, maybe. – leppie Apr 07 '16 at 19:46
  • @leppie thanks. see my updated question – Charles Okwuagwu Apr 07 '16 at 19:55
  • @CharlesO "functionality stops working" isn't descriptive enough to determine. It sounds like it's a different issue - the library will fail at binding time with exceptions if the runtime policy is wrong. On a separate note, you shouldn't have the 2nd runtime line in your file, only `v4.0` – Reed Copsey Apr 07 '16 at 21:02
  • @leppie This is what i have tried: with .net 4.0 there are no issues. Once i move to 4.5 I still don't have any run-time errors, but the function calls to the 2.0 library begin to give incorrect results. Because there are no errors thrown, I am unable to describe my situation any further. – Charles Okwuagwu Apr 07 '16 at 21:41
  • What are these 'incorrect results'? – leppie Apr 08 '16 at 03:59
  • @leppie for example the 2.0 library in question is for a fingerprint reader. One of its basic function calls enumerates all the Fingerprint readers attached to your machine. This always returns nothing for .net 4.5, but gives expected results on .net 4.0 and below. – Charles Okwuagwu Apr 08 '16 at 07:20
  • Remove ``, if you program is compiled for 4.5, it will use it automatically. Alternatively, try `` – leppie Apr 08 '16 at 07:26
  • Tried both variants... on .net4.5 same result, not working. – Charles Okwuagwu Apr 08 '16 at 07:31
  • @leppie other who reported similar claimed it had to do with their Test project and they fixed it by making the config adjustments in some None-Project folders elsewhere. sadly those fixes do not apply to my case, for example this: http://stackoverflow.com/a/16126870/44080 – Charles Okwuagwu Apr 08 '16 at 07:40
  • :*( IS it possible for you to debug the mixed mode assembly? (Also retagged, as mixed-mode is actually relevant here) – leppie Apr 08 '16 at 07:59
  • @leppie I can try to remove "just my code" feature, but the 3rd part dll is a library from the fingerprint reader vendor. – Charles Okwuagwu Apr 08 '16 at 08:05

0 Answers0