Selecting the .NET Version

When you use wwDotnetBridge, you are loading the .NET runtime into your Visual FoxPro application. Only one single version of the .NET runtime can be loaded and it's important that your application loads the highest version it will need to function properly.

As of version 6.10 wwDotnetBridge only works with .NET 4.0 and later. Due to other dependencies and support components that are used by Web Connection and Client Tools .NET 4.0 is now required. V4 is the default. Note that V4 covers .NET 4.0, 4.5, 4.6, 4.7.

If you don't specify a version with calls to GetwwDotnetBridge() or CREATEOBJECT("wwDotnetBridge"), wwDotnetBridge attempts to load the highest installed version of .NET. While that's a reasonable idea, in practice it's better to ensure you explicitly specify what version your application requires in order to run properly to ensure you can catch failures if the right version of .NET is not installed.

We recommend you specify the version you require for your application in the startup code of your application like this:

*** In your application startup code
InitializeDotnetVersion("V4")

to ensure that the .NET version is explicit loaded and not at random by components in your application.

.NET Versions

.NET Versioning can be a bit confusing due to Microsoft's funky version naming strategy. There are only two main major versions of .NET out in the wild today:

  • .NET 4.x ("V4")
    This is the latest version of .NET and encompasses 4.0, 4.5.x and 4.6.x. We recommend you always target this version as .NET 4 installed with Windows 8 and later.

  • .NET 2.0 ("V2)
    This version encompasses .NET 2.0, 3.0 and 3.5. The 3.x versions were framework updates running on the actual .NET 2.0 runtimes so they qualify as .NET 2.

.NET 4.0 Client Profile is Not Supported!

.NET 4.0 had a short lived .NET Client Profile runtime that excluded all server functionality. It was more lightweight but excluded some of the functionality that is loaded by default in wwDotnetBridge. This version is not supported by wwDotnetBridge.

We recommend you require .NET 4.5 or higher for your applications to avoid the 4.0 client profile trap.

Specifying .NET Version explicitly

There are three ways to specify the .NET version with wwDotnetBridge:

  • GetwwDotnetBridge() with a version specifier
  • Using the "V2", "V4" version shortcuts for .NET 2.0 and 4.0 respectively
  • Using a full version like "v4.0.30319" explicitly

Note that it's difficult to tell exactly which version of .NET 4.x you actually have installed as all 4.x versions are registered under the 4.0.30319 version label and differing only in the build numbers. Microsoft has instructions on exactly how to check for 4.x versions in an MSDN article.

Using GetwwDotnetBridge

wwDotnetBridge includes a function called GetwwDotnetBridge() which can be used to quickly instantiate a wwDotnetBridge instance. This function caches the instance created so it's reused throughout the application which makes the load time a bit faster if used throughout.

Anywhere you need an instance of wwDotnetBridge you can use:

loBridge = GetwwDotnetBridge()

This function also caches global __DOTNETBRIDGE variable that is cached as a PUBLIC variable and reused for subsequent loads for wwDotnetBridge which improves (the relatively minor) load time.

This method also takes the same version parameters described below, which might be useful for explicitly loading a runtime version at startup of the application to load the highest version of .NET used by the application.

Using the Version Shortcut Strings

loBridge = CREATEOBJECT("wwDotNetBridge","V4")

You can use the special version shortcuts of "V2" or "V4" to specify the .NET version. These shortcuts translate into fully qualified version strings.

Use a specific version of the the .NET Runtime

loBridge = CREATEOBJECT("wwDotNetBridge","v4.0.30319")

This option allows you to very specifically reference a runtime version for .NET. The "V2" and "V4" defaults map to the specific runtime versions, so we recommend for V2 and V4 you use those shortcuts.

This function is here mainly for future versions - when .NET 5.0 or 6.0 releases you will be able to specify the higher version number explicitly.

See also

Selecting the .NET Version | Frequently Asked Questions

© West Wind Technologies, 1996-2019 • Updated: 09/01/17
Comment or report problem with topic