logo
down
shadow

Problem using ‘useLegacyV2RuntimeActivationPolicy’ & supportedRuntime in an application


Problem using ‘useLegacyV2RuntimeActivationPolicy’ & supportedRuntime in an application

By : Nathan Hood
Date : January 02 2021, 06:48 AM
will help you I'm not sure exactly what behavior you're seeing for VS2005, but it shouldn't be the case that "most of the Visual Studio used .NET 2.0 but I was able to make use of an assembly targeting .NET 4.0 framework". That config should cause everything in the process to run on v4. If this is not the case, I'd certainly like to know about it because it's likely a bug. (BTW, I'm sure you realize that you're outside a supported scenario by rolling VS2005 forward to v4.)
As to the invalid operation exception, my guess would be that you're hitting some kind of incompatibility between frameworks. I'm sure we'd like to get a bug on that as well. Can you share the stack trace at the exception?
code :


Share : facebook icon twitter icon
Set .Net 4 'useLegacyV2RuntimeActivationPolicy' during runtime?

Set .Net 4 'useLegacyV2RuntimeActivationPolicy' during runtime?


By : Chris G
Date : March 29 2020, 07:55 AM
it helps some times This can be done via the CLR Hosting APIs. I detail the technique here.
Application built with .NET 3.5 running on machine with only .NET 4.0. How does supportedRuntime element work?

Application built with .NET 3.5 running on machine with only .NET 4.0. How does supportedRuntime element work?


By : Ashin pote
Date : March 29 2020, 07:55 AM
this one helps. Adding Hans Passant's comment as it seems a suitable answer.
The application will crash. To run on .NET 4.0 you need to add another supportedRuntime attribute with version="4.0".
"useLegacyV2RuntimeActivationPolicy=true" not working when application is loaded using Process.Start

"useLegacyV2RuntimeActivationPolicy=true" not working when application is loaded using Process.Start


By : André Carlos
Date : March 29 2020, 07:55 AM
will help you Nevermind. The file "myApplicationThatUsesSmo.exe.config" was indeed missing in the folder where "myApplicationThatUsesSmo.exe" was being started.
"myApplicationThatUsesSmo.exe" is set as a reference for "myApplicationThatCallsProcessStart.exe" and so it is copied to the "myApplicationThatCallsProcessStart.exe" output folder. But its config file is not. There was a build event coping this file, but some how it was erased and than things stoped working.
Can I run scriptcs with useLegacyV2RuntimeActivationPolicy?

Can I run scriptcs with useLegacyV2RuntimeActivationPolicy?


By : user3834991
Date : March 29 2020, 07:55 AM
this one helps. Your app.config file will be renamed to program.exe.config. In order to do this with ScriptCS you just need a file named scriptcs.exe.config that has the useLegacyV2RuntimeActivationPolicy startup node in it.
How do I set an unmanaged application's prefered CLR (<supportedRuntime>) at run time?

How do I set an unmanaged application's prefered CLR (<supportedRuntime>) at run time?


By : fUser2
Date : March 29 2020, 07:55 AM
To fix this issue The and useLegacyV2RuntimeActivationPolicy stuff is really only necessary if you either have mixed-mode assemblies (where, for backwards compatibility reasons, it will not load them in anything beyond the CLR 2.0) or 2.x assemblies trying to load 4.x ones.
If you have pure managed assemblies, then .NET 4's in-process side-by-side execution will ensure that both CLR 2.x and CLR 4.x can be loaded in the same process, as needed by assemblies. The only real problem you could run into is that an assembly loaded in the 2.x runtime won't be able to load a 4.x assembly; in that scenario you would still have to force the 4.x framework through configuration. Likewise, sharing data through remoting and AppDomains won't work for components running in different frameworks, though that's a fairly rare scenario.
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk