Use this function in your application's startup program to force the .NET version used by wwDotnetBridge for the entire application.

Just put the following some in your application's startup code:

InitializeDotnetVersion("V4")  && or V2


This is an important feature and we highly recommend you add the above line of code to the beginning of every application that uses wwDotnetBridge.

Why do this?

Calling this method forces the .NET Runtime version to either .NET 4.x or .NET 2. You are explicitly setting the .NET version that's used by wwDotnetBridge (or .NET COM Interop in general) throughout your application, so any attempt to create a new instance of wwDotnetBridge with a different version will still only get the version that you initially set.

Each application can host only a single instance of the .NET runtime and this function sets the version.

We also recommend that you target V4 as .NET 4.x is the most widely installed version of .NET. Even if you are calling v2 .NET libraries as these can run just fine under .NET 4.x.



The .NET Runtime version to use.

V4 or V2

If you leave the value blank V4 is used.


Static Function

This is a static function, not a method of wwDotnetBridge

Version Support

Only the .NET 4 and .NET 2 runtimes are supported.

.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

Note that 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-2021 • Updated: 06/02/21
Comment or report problem with topic