Creating a Microsoft Office Outlook 2007 add-in
[40 mn of reading - published 4/27/2006 10:52:26 AM - Target : Confirmé]
|
   
|
Author
6. Deploying an add-in
Contrary to the other types of more "traditional" applications, the deployment of a Microsoft Office Outlook 2007 add-in is more complicated in the way that it requires prerequisites but also to define security options in order to make it work correctly.
This part will aim to describe the various preparation stages of a Microsoft Office 2007 add-in deployment project.
6.1 Adding prerequisites
The deployment of a Microsoft Office Outlook 2007 add-in on a computer requires the installation of many prerequisites :
- Microsoft .NET Framework version 2.0. - Microsoft Visual Studio 2005 Tools for Office v3 runtime. - Microsoft Office 2007 primary interop assembly (installed by default during the complete installation of Microsoft Office 2007) : libraries used by the add-in to access to Microsoft Office 2007.
These various prerequisites can be added from the deployment project's properties windows. For that, you have to perform the following steps :
Step 1 : Right-click on the project and click on "Properties" :

Step 2 : In the project's properties window, click on "Prerequisites..." :

Step 3 : Check the "Create setup program to install prerequisite components" and "Download prerequisites from the same location as my application" options in order to make the prerequisites' installation files directly accessible from the deployment program directory :

|

|
By default, Microsoft Visual Studio 2005 only proposes to add the Microsoft .NET Framework version 2.0 to the installation program. However, it is also possible to add manually the new prerequisites from the "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages" directory as described in the following article. |
|

|
The installation files of the Microsoft Visual Studio 2005 Tools for Office v3 runtime and Microsoft Office 2007 primary interop assembly prerequisites are not yet avaible to the public. |
Step 4 : After having selected the prerequisites to add to the deployment project, click on "OK" twice. During the project compilation, a directory will be created for each prerequisite in the output directory. Each directory contains the required installation files.
6.2 Signing the add-in assembly
Before giving the appropriate authorizations to the assembly, you have to sign it. For that, you have to perform the following steps :
Step 1 : Double-click on the "Properties" node of the project corresponding to the add-in :

Step 2 : Click on the "Signing" tab :

Step 3 : Check the "Sign the assembly" option and then in the "Choose a strong name key file" list, click on "<New...>" :

Step 4 : In the "Create Strong Name Key" window, enter a name for the file that will contain the key and also a password to protect it and then click on "OK" :

Step 5 : A new file that contains the key is then added to the project :

6.3 Trusting the assembly
In order to trust an assembly, you either have to do it from the .NET framework administration console (in the control panel) or directly during the installation process. In this last case, you have to perform the following steps :
Step 1 : Download the following package and extract it.
Step 2 : Copy the "C:\Program Files\Microsoft Visual Studio 2005 Tools for Office Resources\VSTO2005 Windows Installer Sample\projects\SetSecurity" directory in the solution directory.
Step 3 : In Microsoft Visual Studio 2005, right-click on the solution and then select "Add" and click on "Existing Project..." :

Step 4 : In the "Add Existing Project" window, select the SetSecurity.csproj file and click on "Open" :

Step 5 : The SetSecurity project is then added to the solution. Click on "File System Editor" in the solution explorer window :

|

|
The SetSecurity project allows to give the assembly the FullTrust authorization. |
Step 6 : Right-click on the "Application Folder" node, select "Add" and click on "Project Output..." :

Step 7 : In the "Add Project Output Group" window, in the "Project" list, select the SetSecurity project and click on "Primary output" and "OK" :

Step 8 : Click on "Custom Actions Editor" in the solution explorer window :

Step 9 : Right-click on the "Install" node, and select "Add Custom Action..." :

Step 10 : In the "Select Item in Project" window, select "Primary output from SetSecurity (Active)" and click "OK" :

Step 11 : Right-click on the "Primary output from SetSecurity (Active)" node and click on "Properties Window" :

Step 12 : In the custom action's "CustomActionData" property, enter the following value where SampleAddin corresponds to the name of the add-in assembly and Sample to the manufacturer :
|

|
/assemblyName="SampleAddin.dll" /targetDir="[TARGETDIR]\" /solutionCodeGroupName="Sample.SampleAddin" /solutionCodeGroupDescription="Code group for sampleAddin" /assemblyCodeGroupName="SampleAddin" /assemblyCodeGroupDescription="Code group for SampleAddin" /allUsers=[ALLUSERS] |

|

|
This custom action allows to give the assembly the FullTrust authorization. |
Step 13 : Repeat steps 9 through 12 for the "Rollback" and "Uninstall" nodes with the following value for the "CustomActionData" property :
|

|
/solutionCodeGroupName="Sample.SampleAddin" |

|

|
This custom action allows to delete the FullTrust authorization for the assembly. |
6.4 Creating the deployment files
The deployment project is now ready. You only have to compile it in order to get the add-in's installation file in the ".\Release" directory.
|