Groups | Blog | Home
all groups > dotnet interop > april 2006 >

dotnet interop : excel 2003 not using latest framework for com interop


vomacka NO[at]SPAM gmail.com
4/27/2006 11:28:35 AM
I am having some trouble running a 2.0 assembly from an excel VBA macro
(unmanaged code). Essentially, on some machines, excel (2000 and 2003)
defaults to using the 1.1 framework to load assemblies even though the
2.0 framework is installed. I've seen this on Win 2000 and XP
machines with and without visual studio 8 installed. On other
machines (win 2000 and win 2003 server with and without visual studio)
I've see excel default to using the 2.0 framework and had everything
run fine. Everything I've read says that Excel2003 should use the
latest installed framework:
http://msdn2.microsoft.com/en-us/library/y89ktbw6.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconlocatingruntimeversioninformation.asp

On some of my machines it is clearly not - the FusLog shows that it is
using the 1.1 framework and thus failing to load my assembly.

I've found one other person compaining of this here:
http://spaces.msn.com/ilvyanyatka/blog/cns!EA0C02AB2E2FCFAC!181.entry?_c=BlogPart

And her solution is to create an Excel.exe.config file in the Office
directory that includes a supportedRuntime tag for v2.0.50727. This
does work, but the solution seems hinky. For one - I don't want to have
to deploy this config file across my company. Second - everything says
that it should default to the latest framework - and it is on some
machines.

Here's the kicker. I know the 2.0 framework is installed correctly
because when I try to create the 2.0 assembly from a plain vb6
application, it works correctly and Fuslog confirms that it uses the
2.0 assembly manager. It seems that only excel has this strange
problem.

My question is that in the absense of an Excel.exe.config file, what is
controlling the default framaework that excel is using? What could be
different between the machines where the assembly loads and the ones
where it doesn't load? Bear in mind that other unmanaged code (plain
vb6) does use the correct framework.

Registry settings? Security policy?
I don't think its the order of install, because office 2003 was
installed on my machine well before the 2.0 framework.

Thanks
Kevin Hector
5/19/2006 4:45:01 AM
did you ever get a response or work out how to fix this? i have the exact
same problem and Excel.exe.config is a really ugly solution!

kevin

[quoted text, click to view]
AddThis Social Bookmark Button