Outlook Add-in w/ VS 2005 Installation Woes

R

rkozlin

I have developed an Outlook add-in using VSTO that is working as intended
when launched from the IDE. However, when I build the installation package
and install it on my development machine, my add-in will not load.

I have checked in Tools -> Options -> Other -> Advanced -> COM Add-ins and
the add-in is listed as having had a runtime error and was not loaded. Also
the Loadbehavior setting in the registry is changed from 3 to 2.

I proceeded to error wrap the auto-generated code in the
ThisApplication.Designer.cs file to try and catch this error, however I have
determined that none of the code runs at all. This tells me it is likely a
dependency or registry setting that is incorrect.

I have refreshed the detected dependencies - which changed nothing. By
default the following dependencies were excluded from the setup project. I
have attempted different combinations of having some exluded some not, etc.

Microsoft.Office.Interop.Outlook.dll
Microsoft.Office.Tools.Outlook.dll
Microsoft.VisualStudio.Tools.Applications.Runtime.dll
Microsoft.VisualStudio.Tools.Applications.Runtime.tlb
office.dll

Another interesting note is that after installing using the setup project's
output, if I run the project just once in release mode from the IDE the
add-in does load. After that it will then load properly when running the
add-in by just running Outlook. So something the IDE is doing that the
Installer is not doing seems to be the key. Unfortunately, the only change I
have been able to notice is that it changes the 'ManifestLocation' registry
setting gets changed from the installation directory to the project's
directory.

Anyone out there have some insight into add-ins with VS 2005 using VSTO? I
am using Version 2.0.50727 of the framework and the add-in is written in C#.
The IDE version is 8.0.50727.42.

Thanks
 
M

Mike Bernstein

I have been through exactly the same problem. It is nothing to do with the
IDE or the manifest. It is a code security problem. When you run the add-in
from the IDE, it is loading the add-in .dll from the build directory, which
has a security status of 'Full Trust' by default. When you install the
add-in the .dll tries to load from the installation directory, which does
not have the same 'Full Trust' security status and cannot load. If you Grant
'Full Trust' status to the installation folder and its contents the add-in
will load. You can do this from the .NET Framework 2.0 Configuration Tool
after installation.

See the following MSDN documents:

http://msdn2.microsoft.com/en-us/library/zdc263t0.aspx and

http://msdn2.microsoft.com/library/6exya3kf.aspx

My current problem is how you add this process to an installation CD for
another stand alone PC.

Mike Bernstein
 
R

rkozlin

Thanks for the reply, your advice has sent me in the right direction and I
have been able to run the add-in from my development machine without running
the IDE.

As to the next obvious step, time for more research....


Thanks
 

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