VB.NET Add-in PIA deployment causing mental anguish

A

Andy Stevens

Hi,

I've developed an add-in for Word using the Visual Studio Shared add-in
wizard.
I've been through the following process:-

.. Created initial add-in using Word 2003 (redist) PIAs.
.. Decided to create a version for Office XP
.. Installed Office XP (Alongside 2003)
.. Downloaded Office XP (redist) PIAs
.. Started a simple add-in from scratch using XP PIAs which places a Button
on the standard commandbar
.. Created Setup project
.. Added Word.dll to GAC on target
.. Added registry entries (for PIAs)
.. Excluded Office.dll / stdole.dll (As intructed in Microsoft Docs)

(Have followed all of the documentation I could find on deploying add-ins
with XP PIAs)

Dependencies in setup project are as follows:-

###########################################################

Exensibilty.dll

C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\PublicAssemblies\Extensibility.dll

Microsoft.Office.Interop.Word (Deploying to GAC)

C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Word\10.0.4504.0__31bf3856ad364e35\Microsoft.Office.Interop.Word.dll

Microsoft.Vbe.Interop.dll

C:\WINDOWS\assembly\GAC\Microsoft.Vbe.Interop\10.0.4504.0__31bf3856ad364e35\Microsoft.Vbe.Interop.dll

Office.dll

C:\WINDOWS\assembly\GAC\Office\7.0.3300.0__b03f5f7f11d50a3a\Office.dll

stdole.dll

C:\WINDOWS\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll

#############################################################


Installed add-in on a second machine.

The add-in will only work if I declare the main application Object as type
Object and doesn't start at all if I declare it as Word.Application, event
though I'm Casting the type at startup ie..

Dim applicationObject as Object

... in OnConnection ..

applicationObject = CType(application, Word.Application)

Which doesn't complain at all.

It will also only work if I include the Office.dll (I was instructed to
exclude)

The add-in works fine on the development machine.

Has anyone had similar issues or can anyone provide insight, or perhaps
highlight my stupidity?

Any help would be greatly appreciated.

Regards,

Andy
 
P

Patrick Smith [MSFT]

What version of Office is on the second machine? If you write managed code
against the XP PIA and then try to get it to work on Office 2003, this will
not work correctly. In fact, there is no real compatability for managed
code between Office XP and 2003. We are addressing this in Office 2007
though so that managed code written against 2003 should continue to work
correctly on 2007. For now though, you pretty much need to two versions of
your add-in if you are supporting the Office XP and 2003 versions.
 
A

Andy Stevens

Hey,

Thank you for taking the time to reply to my question.

The version of Office on the target machine is Office XP.

Three quick questions:

1) When implementing the shared add-in solution (I'm only targetting Word)
should I exclude the Office.dll dependency from the setup project?

2) Is it OK seen as I'm targetting Word to define the initial application
object as Word.Application ie. "Dim applicationObject as Word.Application"?

3) If not, should I leave this as Object and use a CType(applicationObject,
Word.Application) everytime I wish to access a property or function?

The Word PIA seems to be deploying to the GAC OK on the target but when I
declare applicationObject as Word.Application as above the add-in doesn't
work... (I'm working with a test add-in at the moment which simply adds a
commandbar button which brings up a messagebox)
 
A

Andy Stevens

Hey again,

OK I may just have been daft, everything seems to work fine if I install the
Office.dll dependency into the GAC as well as the Interop.Word.dll.

However I need to know if this is the wrong thing to do?

Regards,

Andy
 

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