Question

Its in context of a C++ application that uses .net3.5 assemblies through mixed-mode (again targeted .net3.5) assemblies. The native app explicitly loads the .net assemblies.

I mainly want to know the repercussions of using .net3.5 assemblies on .net4. I found a few links that suggest using the useLegacyV2RuntimeActivationPolicy. There is another similar question answer to which suggests its fine, but following links make me think its better to recompile targeting .net4:

"...Apps that were built for versions 2.0, 3.0, and 3.5 can all run on version 3.5, but they will not work on version 4 or later." - On MSDN

"Some framework types have moved across assemblies between versions..." - In an SO answer

"No idea. It depends on the application and which APIs it uses. There were breaking changes in .NET 4 and this application is likely hitting one..." - In an MSDN forum answer

Was it helpful?

Solution

I mainly want to know the repercussions of using .net3.5 assemblies on .net4.

In general, you need to set the runtime activation policy to force .NET 4. This means that your 3.5 assembly will be executed using the CLR 4 runtime, not the CLR 2 runtime.

For most scenarios, things "just work". However, there are definitely edge cases where there could be problems, as there were some subtle changes (as you've linked) in the 4.0 runtime.

In my experience, these issues are very rare, and things typically work flawlessly. I would recommend thorough testing of the 3.5 functionality if you're going to use it in a 4.0 application, however, just to verify that you're not hitting an edge case that is problematic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top