.NET Framework Version 1.1 loaded from a C# Excel AddIn

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have written an Excel addin in C# and have found that everything works fine when I only have v1.0 of the .NET Framework installed on my machine
In a normal C# exe built to work with v1.0, I would expect it by default to load v1.0 even if v1.1 is installed, unless config files or policies etc have been modified. However since the class that is loaded by Excel is a C# class regsitered with COM, version 1.1 of the framework is loaded, and while using v1.1 I have found several incompatabilities

What I need to do is force a certain version to be used( for now v1.0 )... Is there an easy way to do this? All I have found so far is the CorBindToRuntimeHost function? Could this be used

Any help would be much appreciate

John Sandifor
 
John,

You should be able to force the 1.0 version of the runtime to be loaded.
If the entry point for the Excel add in is a .NET dll (not an exe), you
should be able to create a .config file for that dll, and in the config
file, you can set the version of the runtime that you wish to run.

However, you have to be careful. If there is another add in that is
loaded before yours that loads a different version of the framework, I don't
believe you can change it. NewsGator has this issue I believe (as they
state in an InfoWorld article on .NET).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

John Sandiford said:
Hi, I have written an Excel addin in C# and have found that everything
works fine when I only have v1.0 of the .NET Framework installed on my
machine.
In a normal C# exe built to work with v1.0, I would expect it by default
to load v1.0 even if v1.1 is installed, unless config files or policies etc
have been modified. However since the class that is loaded by Excel is a C#
class regsitered with COM, version 1.1 of the framework is loaded, and while
using v1.1 I have found several incompatabilities.
What I need to do is force a certain version to be used( for now v1.0 )...
Is there an easy way to do this? All I have found so far is the
CorBindToRuntimeHost function? Could this be used?
 
Back
Top