index > Visual Studio Tools for Office > How to add caspol security settings for referenced assemblies

How to add caspol security settings for referenced assemblies


I'm building an Outlook add-in using VSTO 2005 targeted at Outlook 2003.

I've successfully added the SetSecurity project (from the MSDN "Deploying VS2005 Tools for Office Solutions Using Windows Installer" 2 part series) to my solution, which appears to properly configure security for my primary dll when my add in is deployed to another machine using my setup project.

However, the SetSecurity project sample doesn't appear to set up permissions for the com objects referenced in my add-in and my add-in throws an error when I run it. Specifically, my add-in uses the CDO and web browser com objects, so I'm guessing I also need to add Caspol calls for the Interop.MAPI.dll and the Interop.SHDocVw.dll to my setup project?

What's the best way to do this? I've never used Caspol before, so its syntax is Greek to me (i.e. the specifiec syntax would be most helpful)!.

Thanks for any thelp!

David H.
David -

You have to add a security policy for each referenced assembly. The example provided in the MSDN only handles a single assembly. If you have more than a single assembly, you'll either need to modify the SetSecurity code provided by MS to handle that, or just make calls to the CasPol command-line utility from your installer.





-dhtroy
Douglas H. Troy
Also when using CasPol one can specify that a whole directory is trusted instead of individual Assemblies.1  Such as:

caspol -u -ag All_Code -url "C:\TestVSTO\*
OmegaMan
You can do this, and I fully understand the desire a developer might have for wanting to make this choice, but one must realize this creates a security risk. Now any assembly dumped into that directory has execution permissions and this kind of thing should be taken into account, especially since we're dealing with customers systems, and not our own.

IMHO, it is far better to grant the necessary security to those assemblies that you will use, and digitally sign those that you have control over ...

Once you understand how Security Policies work, and how to create them, it's very easy add/remove assemblies from a security grouping, without the need to grant the entire directory full trust execution permissions.

My two cents.





-dhtroy
Douglas H. Troy
I actually agree with DHT in terms of security....once you have a handle on the situation, specify each one individually.
OmegaMan
reply 5

You can use google to search for other answers

 

More Articles

importing data from an excel file
How to load word documents from a memory stream
Import a XML data file into Word 2003 Template with prepared xsd ...
Publish to SharePoint?
Exchange Access - Save Error
Pivot table using c#
Unable to build MSI/Setup program referencing Outlook Addin
I need to view the source of a .pst file
Problems with office sp1 installation
Help embedding Excel documents into a Word Document
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Trouble to install VSTO
Disable/Enable menu items based on the p…
[SOS] Why I can't create a new sheet via…
Need to Modify install location of VS 2005
Multi-threading in VSTO
VS 2005 Professional with Office Tools
c# automation - copy excel table to a po…
CommandBarButton and User Control Relati…
Ambiguity between 'Microsoft.Office.Inte…
Using Refedit Control in VB or Vb .net
How do you disable the Close (X) button …
Searching Files
plz help me
Outlook 10 :MAPIFolder.Items.Find fails …
rtf/wmf question

Hot Articles

Microsoft Outlook 2003 query - How to..
How to get nested tables in Microsoft.Of…
open a .pps in a .net form
Open action-pane from any existing word …
Smart Doc Pane Failes to refresh in WINX…
Intercepting Word's message pump
Document Protection disables too much!?
Why VSTO doesnt work on WinXp and it doe…
Merge Field Collection devoid of merge f…
VS 2003 enterprise developer and vs 2005…
Programmatically insert a TOC entry and …
Dynamically installing/loading and unins…
How to determine current XMLNode in a XM…
KeyPress Event in .Dot Files
Can we use outlook object with Exchange

Recommend Articles

Developing code for MS Office 10.0/11.0 …
VSTA Integration
VB.Net COM Add-In for Excel Nightmare! p…
Attaching solution to Document on the fly
nesting multiple sumif statements
problems with deployment of VSTO 2005 Ex…
Developing add-in for Outlook 2000 - spe…
Help!. regarding Visio SDK layout
unload Smart Document on initialize
Installation VST 2005
BUG, OutLook 2003 Add-in only installs f…
Accelerate Smart Tag Recogntion
Big Trouble with Encrypted Emails in VST…
Problem Saving Multiple Documents 2 Ques…
XML View and how to change reading pane …