Is there a setting that tells Word which version of .Net to use

G

Gerhardo

Hi,

We had a strange issue using Word. We wrote an add-in for Office 11. The
add-in makes a call to a COM object implemented in .Net version 2.X. The
assembly was registered with regasm and the codebase switch. It was not part
of the GAC. We could create a little VB script or a VB 6 app and perform a
createobject(MyNet.Component) without any trouble. When we tried to do the
same thing from VBA code in Word, however, it failed to load the assembly.

It turns out that Word ended up trying to load the assembly with an earlier
version. of .Net on some machines. There was no winword.exe.config file
present instructing Word to do so. I assumed that by default, it would always
try to use the most recent version of the framework. I fixed it by putting
such a config file into the Office11 directory. Now we can create the object
just fine.

I'd like to know what made Word determine to use the older version of the
framework? As far as I know, it would use the most recent one in the absence
of a winword.exe.config instructing it otherwise. That did not appear to be
the case on some machines.

Is there a Word specific setting somewhere (I saw nothing with RegMon)? The
only other scenario is that some add-in was loaded which referenced code in
an earlier version of .Net and thus ended up loading the earlier version by
default.
 
M

Michael Herzfeld [MSFT]

Hi Gerhardo. It's possible that what you mentioned in your last
paragraph is the culprit (an add-in loaded an earlier version of the
CLR) in which case the workaround is to use the winword.exe.config.

However, you may be hitting another known issue which addressed in the
following KB article.

http://support.microsoft.com/kb/907417

Let me know if this helps.

Michael Herzfeld
Office Programmability Test Team


-----Original Message-----
From: Gerhardo [mailto:[email protected]]
Posted At: Monday, November 21, 2005 2:35 PM
Posted To: microsoft.public.office.developer.vba
Conversation: Is there a setting that tells Word which version of .Net
to use
Subject: Is there a setting that tells Word which version of .Net to use

Hi,

We had a strange issue using Word. We wrote an add-in for Office 11. The

add-in makes a call to a COM object implemented in .Net version 2.X. The

assembly was registered with regasm and the codebase switch. It was not
part
of the GAC. We could create a little VB script or a VB 6 app and perform
a
createobject(MyNet.Component) without any trouble. When we tried to do
the
same thing from VBA code in Word, however, it failed to load the
assembly.

It turns out that Word ended up trying to load the assembly with an
earlier
version. of .Net on some machines. There was no winword.exe.config file

present instructing Word to do so. I assumed that by default, it would
always
try to use the most recent version of the framework. I fixed it by
putting
such a config file into the Office11 directory. Now we can create the
object
just fine.

I'd like to know what made Word determine to use the older version of
the
framework? As far as I know, it would use the most recent one in the
absence
of a winword.exe.config instructing it otherwise. That did not appear to
be
the case on some machines.

Is there a Word specific setting somewhere (I saw nothing with RegMon)?
The
only other scenario is that some add-in was loaded which referenced code
in
an earlier version of .Net and thus ended up loading the earlier version
by
default.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top