Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to force C# project as part of bigger solution in Visual Studio 2010/2013 to load the dlls it uses in .NET v3.5 (CLR v2.0.50727)?

$
0
0

We have an application using WinAPI and MFC with about 50 projects, mainly in C++, 1 project is in C++/CLI using .NET v4.0 and 1 project is in C# using .NET and this project loads registered dlls from path specified in privatePath in .config file and I need to load them in .NET 3.5 (CLR v2.0.50727), how to do it?

I can't change the version of that C++/CLI project to 3.5 and have whole app running on .NET 3.5 because it needs the 4.0 features.

Changing the C# project TargetFrameworkVersion to 3.5 doesn't have any impact, setting System and System.Core reference RequiredTargetFramework of the project to 3.5 doesn't have any impact, setting supportedRuntime version of the .config file to v2.0.50727 doesn't have any impact and the dlls are still loaded in CLR v4.0.30319.

The only setting that I found that has impact is startup useLegacyV2RuntimeActivationPolicy in .config file, when I set it to true and set supportedRuntime version to v2.0.50727, then I see that CLR v2.0.50727 tries to load the dlls, but fails with "CLR:(*.dll) ERR: Rejecting IJW module built against v2.0.50727 because it could be loaded into another runtime in this process." and then loads them in v4.0.30319.

I tried to fix this problem on my own by using information from forums, sites, blogs etc, but nothing works for me and I haven't found this particular problem anywhere.

Edit: I tried setting tags NetFx40_LegacySecurityPolicy, NetFx40_PInvokeStackResilience, PreferComInsteadOfManagedRemoting and supportPortability in the .config file without any impact, too. Still "CLR:(*.dll) ERR: Rejecting IJW module built against v2.0.50727 because it could be loaded into another runtime in this process.". 


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>