Thursday, December 08, 2005

Delphi Co-existence in a .Net 2.0 world

It wasn't very long after the release of the latest Microsoft .net 2.0 framework that applications were getting written to it, and the applications which we deployed using Delphi (and the .net 1.x frameworks) abruptly ceased to function.

The funny thing is that the portion that I had written for .net was a mutant dll file which allowed me to bridge from our legacy win32 application into the ACT! 2005/2006 SDK. Trying to figure out how (using Delphi 8) to limit what version of the framework to use was painful. Since not all of our customers would require the bridge, I needed to find a solution that would work without requiring the presence of any .net framework.

The solution turned out to be very simple. the ".config" file has the ability to limit what version of the framework should be loaded for a specific application. What didn't make sense at first was that I had to name the config file after my primary executable, not the dll file (as I first suspected).

So, with the following scenerio:

  • Project1.exe = delphi 7 application
  • bridge.dll = delphi 8 application

  • I needed to name my .config file project1.exe.config

    The contents of which are below:

    <?xml version="1.0"?>
      <supportedRuntime version="v1.1.4322"/>
      <supportedRuntime version="v1.0.3705"/>
      <requiredRuntime version="v1.1.4322"/>

    I have even tested this with other applications which have also failed, and have found it to be a fairly simple solution. Unfortunately it did add another file to manage on my clients computers.

    No comments: