How can I specify that Excel uses the .NET framework version 2.0 when running .NET dlls other than adding an excel.exe.config file to the Office Binary folder?
Our application runs in Excel and uses VBA which makes calls into managed code in .NET assemblies. I believe the textbook way of doing this is to add excel.exe.config to the Office binary directory containing:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
This option is not acceptable for our clients, firstly because they simply won't allow us to add files to the Office directory and even if they did we could not risk breaking some application using .NET v1.1 which is the default choice of Excel.
The solution which we thought would work was to copy the Excel.exe file to our own applications directory from the client's Office directory, to add the config file there and execute that file. It works well but we are having serious installation problems where the install script cannot find the correct version of Excel. Plus it's a nasty kludge in the first place.
Any ideas would be welcome. I wonder if a layer of unmanaged (non .NET) code in a DLL might work. Some advice on how to do this or some simpler alternative would be appreciated as this is non-trivial.