Use this function in your application's startup program to force the .NET Runtime version to be used by wwDotnetBridge
for the entire application. This loads the runtime and thus determines the runtime that will be used for the entire application making calls with wwDotnetBridge
.
Just put the following some in your application's startup code:
InitializeDotnetVersion()
Important
This is an important feature and we highly recommend you add the above line of code to the startup code of every application that uses
wwDotnetBridge
.
Why do this?
Calling this method forces the .NET Runtime version to a specific version and caches it. You are explicitly setting the version that's used by wwDotnetBridge
throughout your application, so any attempt to create a new instance of wwDotnetBridge
always creates an instance in this same runtime version.
Each application can host only a single instance of the .NET Runtime and this function sets the version once on startup of the application so you can ensure consistent runtime version usage.
InitializeDotnetVersion(lcVersion)
Parameters
lcVersion
The .NET Runtime version to use.
V4 or V2
If you leave the value blank V4 is used.
Remarks
Static Function
This is a static function, not a method of wwDotnetBridge
Version Support
Only the .NET 4 and .NET 2 runtimes are supported. V2 is not recommended at this point - there should be no need for it as you can run V2 components in v4. The only reason for V2 might some special .NET3.5 components.
Latest .NET 4 runtimes cover:
- .NET 4.0 (full version only, not 4.0 Client Profile)
- .NET 4.5 - 4.8
All 4.x versions are backwards compatible with .NET 4.0 and are inplace replacements for 4.0.
.NET 4.0 Client Profile is not supported due to some dependencies we take that are not available on the client profile.
.NET 2 runtimes cover:
- .NET 2.0
- .NET 3.0
- .NET 3.5
- .NET 3.x is really .NET 2.0 runtimes with additional support libraries (WPF/WCF etc.).
You can load .NET 2.0 Libraries from .NET 4.x
You can load libraries compiled for .NET 2.0 (or 3.0, 3.5) from .NET 4.0, but you cannot load .NET 4.0 compiled libraries from .NET 2.0 in most cases because 4.0 includes many new runtime features.For this reason we recommend you always use .NET 4.0 (V4) in your version initialization at this point including for older versions of Window like XP and Vista.
See also:
Class wwDotNetBridge© West Wind Technologies, 1996-2024 • Updated: 10/10/22
Comment or report problem with topic