Custom Actions

A custom action is a windows installer feature that allows you to run code at the end of an installation to perform additional actions.
You can grant security permissions by using a custom action.



Creating a Custom Action

You can create a custom action by deriving a class from the System.Configuration.Install.Installer class and overwriting the Install, Uninstall and Rollback methods as appropriate.
The custom action overwrites three of the Windows Installer class methods:



SetSecurity Project

The SetSecurity project applies to Office 2003 and Office 2007 solutions created with Visual Studio 2005 and 2008.
This project contains a custom action that can grant trust to an assembly using both its strong name and ifs folder location as evidence.
This assumes you have only got a single customisation assembly and that the solution is being deployed to the local hard drive.


Install - On installation the security policy is created.
Uninstall - The security policy is removed
Rollback - The security policy is removed


Two new code groups are created:
Solution Code - uses the folder location as evidence, sets permission to Nothing
Assembly Code - (child of solution code) uses strong name as evidence



Applying SetSecurity when you have multiple assemblies
you have to add a custom action in your setup project for each dll that you deplay with your project.





© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext