VB.NET - Changing the version of a referenced DLL based on OS

Soldato
Joined
6 Oct 2004
Posts
18,514
Location
Birmingham
Having an interesting problem here with one of our applications.

We have a new version which is built to run on Windows 7 and later. As part of the install, it also installs a load of SQL server components/libraries

Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Management.Sdk.Sfc
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SqlEnum

The current build installs the 2012 versions (11.0.0.0) of these libraries, and references them in the project references, this all works fine.

However, a customer has reported they are having issues with one of the older versions of our product, and would like to upgrade to the latest version. The problem is that they still run XP, and none of the SQL server 2012 components will install on XP.

I have updated the project references to use the 2008r2 versions of the DLLs (10.0.0.0), and for the installer to install the 2008r2 components if running on XP- this works fine on XP, however on Windows 7 we would still like to use the 2012 versions, but when running this build on Windows 7 I get a missing DLL error for the 10.0.0.0 version of the DLL.

When adding the references to the 2008r2 dlls, I set the specific version flag to "False" as I was under the impression this would simply mean that if the specified version of a DLL was missing, the application would instead use the latest version installed, but this doesn't seem to be the case.

My question is basically, is there a relatively simple way of changing the DLLs referenced by the product at runtime, based on which OS it is installed on (or even just to check if the 10.0.0.0 exists, and if not, use the 11.0.0.0)?

The alternative is obviously just to have separate versions for XP and Windows 7, but it would be more elegant to have a single installer for both.

Thanks :)
 
Back
Top Bottom