Using the COM Add-in Shim Solution with VB.Net

M

Murray

Regarding the MS tutorial:
Using the COM Add-in Shim Solution to Deploy Managed COM Add-ins in
Office XP

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/htm
l/odc_comshim.asp

I have tried to get this example working several times, on several machines.
The result is that after the project is installed and MS Word 2002 is
launched, I am asked to trust my test certificate bound to the unmanaged
shim, but the managed VB.Net code does not run. If word is shut down and
restarted, I am not asked to trust the certificate regardless of whether I
chose to always trust the issuer or not.

The only departures from the tutorial I have made are:
1. I have generated a test certificate, and bound it to the unmanaged
shim as described in the article Digital Code Signing Step-by-Step Guide
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmarttag
/html/odc_dcss.asp). I assume test certificates are OK.
2. I have instructed the setup project not to build the shim or managed
add-in, as this removes the certificate attached to the shim earlier.
3. I have tried this tutorial with auto-generated interops, and with the
Office XP PIAs.

Any advice will be very much appreciated. Even some assurance that managed
code can be trusted in office would keep me sane...


Cheer

Murray
 
S

Siew Moi Khor [MS]

Hi Murray,
If you're using test cert, you can only use it on the same machine that you
use to generate the cert. Try setting your security to medium and uncheck
"trust all installed add-ins and templates". You should get a prompt to
enable the unmanaged shim.
restarted, I am not asked to trust the certificate regardless of whether I
chose to always trust the issuer or not.
Could you check the registry and see whether the LoadBehavior has
changed\reset? If it has been reset, it could be something wrong with your
com add-in. Does your managed com add-in work without the shim?

BTW, there is a simpler shim solution:
http://msdn.microsoft.com/library/en-us/dnoxpta/html/odc_ofshim.asp (watch
out for word wrap)

Siew Moi
 
S

Siew Moi Khor [MS]

Hi Murray,
Most likely something failed during OnConnection and when that happens,
Office automatically resets the LoadBehavior from 3 to 2. 2 means addin is
boot-loaded but not connected (unchecked in dialog).

One example: let's say nothing is wrong with the managed com add-ins but the
PIAs that the com add-ins need aren't installed on the machine. This will
cause the LoadBehavior to reset from 3 to 2 because even though the managed
com add-in gets, loaded, it won't get connected as it'll fail OnConnection.
Another example: there is actually a fault with the com add-in.

Siew Moi
---
This posting is provided 'AS IS' with no warranties, and confers no rights.
Sample code subject to http://www.microsoft.com/info/cpyright.htm


Murray said:
Hi Siew

Thanks for the reply.

I am using the same machine on which the test cert was generated.

With security settings on medium and 'trust all' unchecked, I am prompted to
enable the certificate once only, the first time Word is run after
installing the add-in.

Yes, the LoadBehavior registry entry changes from 3 when the add-in is first
installed to 2 after the add-in has attempted to run once. You indicate that
this means the add-in is faulty. However the add in has not been changed,
and it ran successfully without the shim when I first started the tutorial.
So I assume I have done something wrong with strong naming or GUID
generation. It's got me stumped!

I'm looking forward to attempting the simpler solution you provide when I
next get some down-time. Thanks.

Cheers


Murray

Siew Moi Khor said:
Hi Murray,
If you're using test cert, you can only use it on the same machine that you
use to generate the cert. Try setting your security to medium and uncheck
"trust all installed add-ins and templates". You should get a prompt to
enable the unmanaged shim.
whether
I
Could you check the registry and see whether the LoadBehavior has
changed\reset? If it has been reset, it could be something wrong with your
com add-in. Does your managed com add-in work without the shim?

BTW, there is a simpler shim solution:
http://msdn.microsoft.com/library/en-us/dnoxpta/html/odc_ofshim.asp (watch
out for word wrap)

Siew Moi
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/htm whether
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmarttag
 

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