RobClarkson

Hiya all, I hope you can help me. I have created a VSTO Word 2003 addin. The addin contains a number of our own class libraries and 3rd party components. The thing is, the addin just will not work and I think it is because of the class libraries and 3rd party components.

Take the following example:

Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

MsgBox("Start up")

Dim o As ITTeamCommon.ITTeamCommonLibrary = New ITTeamCommon.ITTeamCommonLibrary

MsgBox("Object created")

End Sub

This example will not work i.e. when I start the Word application, the message boxes will not display. If I put a Try...Catch in there, that is completely ignored so I don't even know what the exception is.

If, however I comment out the line that declares and instantiates 'o' then the message boxes display okay.

I am using Microsoft's sample 'SetSecurity' solution. I have built a very similar Outlook 2003 VSTO addin and the works fine and dandy.

Thanks

Rob



Re: Visual Studio Tools for Office Word 2003 VSTO addin won't work when I create objects.

Cindy Meister

Hi Rob

The "obvious" question: Office + VSTO security requires that all .NET components used in the VSTO solution have Full Trust. Are you sure you've assigned Full Trust to all your class libraries as well as the 3rd party components

Will the solution work successfully during debug from within VS






Re: Visual Studio Tools for Office Word 2003 VSTO addin won't work when I create objects.

RobClarkson

Hiya Cindy and thanks for your quick response.

The solution does work during debug from VS. I have not done anything with security but I am using a sample C# solution from Microsoft called "SetSecurity" which, I was given to understand, would sort that out.

I downloaded this from:

http://www.microsoft.com/downloads/details.aspx familyid=6991e869-8d5b-45f4-91e7-b527bd236f4c&displaylang=en

Your response prompted me to look at the .Net 2.0 Configuration Tool .

Under the Runtime Security Policy-->User-->Code Groups-->All_Code->VSTOProjects node I found the solution that I am working on listed. I changed the value of the "Permission Set" for all the listed files to "Full Trust" but it has not made any difference.

Rob





Re: Visual Studio Tools for Office Word 2003 VSTO addin won't work when I create objects.

Ji Zhou ¨C MSFT

Cindy wrote:

Are you sure you've assigned Full Trust to all your class libraries as well as the 3rd party components

Note what Cindy said, please make sure you also give full trust to the 3rd party dll. The SetSecurity project provided by Microsoft only grant full trust to our Add-in dll.

The article http://msdn2.microsoft.com/en-us/library/bb332051.aspx also notes:

"In addition, you must trust any referenced or satellite assemblies with the appropriate level of permissions. Evidence for the trust can consist of an assembly's location, a strong name, a certificate, or a combination of these types of evidence."

Also, refer the discussion here to see if it helps:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2277148&SiteID=1

Thanks

Ji






Re: Visual Studio Tools for Office Word 2003 VSTO addin won't work when I create objects.

RobClarkson

Hi Ji

The fact is I am not sure. I modified the sample SetSecurity solution so that is grants full trust to all the asemblies including my own and the 3rd party ones. I just looped through the files in the directory. I can view this in the .Net 2.0 Configuration tool. But when I load Word, the tool bar does not appear.

Rob