jdrawmer

I've had a lovely little add-in now working on my machine for a while, and yet I haven't been able to deploy it successfully, not even on my own machine once.

The program works absolutely perfectly on my machine when debugging and running through Visual Studio, but when deployment comes, the common error "Not loaded. A runtime error occurred during the loading of the COM Add-in" occurs.

I've now created the simplest of simple add-ins, that simply display "HELLO WORLD" in an attempt to deploy that, to then further, deploy mine - still no look.

The main blog I found which seemed to cover the most problems was

http://weblogs.asp.net/mnissen/articles/427504.aspx

I created the installer class that i read about on there, concerning Code Access Security, and i dunno if the class i've generated has fixed that or not!

Secondly, all the prerequisites that are required for an Outlook Add-in to work, i have set up all the custom prerequisites that are required on the list provided on the above blog. They all compile and build fine, plus i know i have them installed on my computer anyway, so surely the add-in should work once installed especially considering it runs smoothly when running through VS2005

Can someone point me in the direction of something i might be blatently missing in order for this to work on install

Thanks a lot
Jay




Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

hey again,

been looking all weekend again for something on this that will make it work and i'm not quite sure... i've thought of a sort of possibility, and i wonder if someone could tell me if this is the reason.

Although each computer that i'm attempting to install, has outlook 2003, they don't have office 2003, they all run office 2000 instead. could the libraries and references for office 2003 be required, or is there just smoething else

Its driving me insane!!!

Jay





Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

apologies for the length of this, but this is the whole exception error i managed to trap with the add-in loading problem!

I have all the relevant components installed, and i have checked the registries (as best to my knowledge) in a similar reply in this forum... I also have a CAS Installer class i read about in the blog in my other reply in this thread, and i'm guessing it is some security or permissions error, hense the text at the start... can someone point me in a further direction I feel i am close now

Could not load file or assembly 'helloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)


************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'helloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'helloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.HandleOnlineOffline(Exception e, String basePath, String filePath)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadStartupAssembly(EntryPoint entryPoint, Dependency dependency, Dictionary`2 assembliesHash)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ConfigureAppDomain()
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadAssembliesAndConfigureAppDomain(IHostServiceProvider serviceProvider)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.LoadEntryPointsHelper(IHostServiceProvider serviceProvider)




************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.Tools.Applications.Runtime
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.816
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.dll
----------------------------------------
Microsoft.Office.Tools.Common
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.816
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Tools.Common/8.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------



thanks a lot in advance!
Jay





Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

Peter Jausovec

Hi Jay,

Looks like there are some problems with CAS policy: Failed to grant permission to execute. I would suggest you try to set the policy on your computer manually.






Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

and how do i do this Although i'm not really new to programming, i'm new to the whole .NET environment, and especially add-in programming using VSTO - especially deploying them.

Thanks





Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

Peter Jausovec

Hi Jay,

Go to Administrative tools in Control panel and open up .NET Framework 2.0 Configuration. Expand Runtime Security policy, Machine, Code Groups and see if your custom installer has added the entry for your VSTO project. Since you're new to .NET environment I would suggest you read the articles under section VSTO deployment in this thread http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=196504&SiteID=1






Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

absolutely no trace of my system anywhere...

All i'm wondering is, what steps are taken to get full trust to my program. Why is it so difficult why is there no step by step guide ANYWHERE! There's bits here and bits there but nothing hard to get the add-in on the road... I know i'm getting there, its just so frustrating.

Can you give me some clear steps to take to get this CAS show on the road, and so my system is granted permission to run.

Thank you so much!
Jay





Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

Peter Jausovec

Hi Jay,

This article explains how to set the policy: http://code-magazine.com/article.aspx quickid=0405031&page=3




Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

ok this is really annoying me now... now i find that the mscorcfg tool doesn't ship with the .NET framework! So i can get this to run fine on my computer, but can't set up CAS on any other machine without the SDK

All i want to do is setup this custom Security Group on INSTALL of my system! Why is it so difficult Why can't this run on any other machine Am i going to have to set up the SDK as a prerequisite, just to have the mscorcfg on every machine, to then have to manually setup a code group

Please tell me this is possible to automate through the code and install its self, so that nothing else is required except the obvious prerequisites!

Thanks,






Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

Peter Jausovec

Hi Jay,

So you got it working on your computer

You can still setup the CAS from your code, with custom installer (as described in Mads article and in the deployment articles above). You won't need to install SDK, you can do the custom installer which will add the code group.

Go though the Mads article again, I am almost 100% sure your custom installer doesn't run and maybe you forgot something. Code is working, beacuse it has helped many people on this forum who posted similar questions.




Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

thanks peter,

its looking good using this installer properly... however, i've generated a new installer class, completely copied the code and wittled it down to this error, which i don't understand as the attribute, to my knowledge isn't set anywhere else...

Attribute 'RunInstallerAttribute' cannot be applied multiple times

this error highlights the top of the code, where the RubInstallerAttribute is referred to as true, next to 'Public Class Installer'

Thanks for all your help,






Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

TOTAL CONFUSION! ! ! ! ! ! !

Ok, so i managed to get the installer class working, and set to the primary output, for some reason had to totally take out the RunInstallerAttribute.

Now... my system consists of a custom main toolbar, with two buttons (Manual Input and Manual Output). A custom toolbar that contains one button, (Inputs) when a new inspector window is open... and an event handler for mailItem_Send event, to interupt the sending of an email.

This is now what happens, on my system when running through Visual Studio, on my system installed, and on another machine, installed.

1) My machine, through Visual Studio - The system runs fine, no problems
2) My machine, installed with Visual Studio installed but not running - The system loads fine, custom toolbar loads correctly, and both buttons work, until outlook is closed and opened at another time (strange ). The inputs work fine, having opened the inspector window, and the outputs work fine, with the mailItem_Send event.
3) Another machine, installed without Visual Studio installed or running - The system loads fine, however the custom toolbar buttons don't work from the start, the inspector custom toolbar fails to open, and with the mailitem_send event handler, the form opens great, and the interupt works perfectly for internal email, but seems to pause on the form for external mail

I'm completely confused as to how so many outcomes can occur - i'm mainly confused as to how the system doesn't work properly, but almost properly on my own machine, yet completely differently in the other machine... Is it because i have other possible prerequisites already installed i don't know about Something the install is missing, that makes it not quite work properly

If anyone could point me in the right direction i would be greatful :) can't believe this has been so much trouble.

Jay





Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

Peter Jausovec

Hi,

I am glad you manage to get it working.

ad 2) Looks like your addin is doing some bad work and that could be the reason Outlook doesn't load it on the second run. Check the Help->About->Disable items to see if your addin gets disabled.

ad 3) I don't understand this one. Where do you have the variables for CommandBar If you're declaring and creating a Commandbar in a method -> move the declaration out of the method and to the class.







Re: Visual Studio Tools for Office VSTO Outlook 2003 Add-in Deployment problems

jdrawmer

hey Peter,

regarding the first point, its not that the add-in doesn't load in the second instance, because on both mine and the other machine, the outputs ALWAYS work (mailItem_Send event) and for me the inputs works everytime, however on second load the custom toolbar buttons don't seem to load anything, and yet they do in VS debugging.

I have the commandbar declared in the application_startup... so on start up, the commandbar attempts to get the value of the command bar ("Bennett Associates"). if that doesn't exist, it creates it.

Thanks,
Jay