Visual Studio Developer Center > Visual Studio Forums > Visual Studio Tools for Office > Outlook 2003 VSTO Addin deployment on Windows Vista - Registry and other issues - How to
Ask a questionAsk a question
 

AnswerOutlook 2003 VSTO Addin deployment on Windows Vista - Registry and other issues - How to

  • Friday, June 05, 2009 9:22 AMChaitanya Joshi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello everybody,

    First of all thanks a lot for all of yours' support on forums, blogs and dev networks with the help of which development becomes very easy and motivating.

    I've developed an addin for Outlook 2003 using VSTO SE and VS 2005 (C#). By referring to the articles regarding deployment I was able to manage to create its MSI installer from setup and deployment project in the solution. The addin gets properly installed on other machines having Outlook 2003 and works there fine. All the security policies are granted properly as well. I am using SetSecurity project for granting trust to assemblies. For that I had referred to articles
    Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer Part 1 & 2 (http://msdn.microsoft.com/en-us/library/aa537173(office.11).aspx) (http://msdn.microsoft.com/en-us/library/aa537179.aspx)

    Now I want to deploy the same addin for Windows Vista. I am aware of the issues faced due to UAC. The major issue is regarding admin access to installer and need of presence of registry keys in HKLM when UAC is turned off. In my installer project I can add those additional registry keys in Registry view. Now my questions are (finally ...)

    1. I want to know whether it is possible to use a single installer for Windows XP and Windows Vista. If yes, how can I determine OS version in my Custom Actions or Launch Conditions?
    2. If answer to previous question is positive then are there any changes required in method of granting trust to assemblies For Windows Vista? I've already stated that I'm using modified version of SetSecurity project for that.
    3. How can determine in Windows Vista whether the UAC has been turned on or off? How can I set a registry launch condition for that so that I can register additional keys in HKLM hive. I'm anyways going to add keys in HKCU for both XP as well as Vista.
    4. How can I add those registry keys if I find that it's Windows Vista and UAC is turned off?

    I've read articles. They say all about where to change in the registry of Windows Vista, but not how to change it.
    • Deploying Application Level Addins (http://msdn.microsoft.com/en-us/library/ms269007(VS.80).aspx)
    • Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2) (http://msdn.microsoft.com/en-us/library/bb332051.aspx)
    • Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer: Walkthroughs (Part 2 of 2) (http://msdn.microsoft.com/en-us/library/bb332052.aspx)
    Thanks a lot once again for your appreciation. Awaiting the reply.

    regards,

    Chaitanya

Answers

  • Tuesday, July 07, 2009 11:56 AMChaitanya Joshi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Well I got the problem solved without much detour and making some changes in installer project itself.

    On MSDN, you can find the necessary change in registry keys to deploy VSTO addin on Windows Vista when UAC is ON or OFF.

    The registry keys for the plugin are generally located in
    HKCU\Software\Classes\CLSID\<ADDIN-GUID> and
    HKCU\<ADDIN-NAME>
    for single user configuration.

    On Windows Vista, if configuration is same and UAC is ON then above registry settings work and no additional things are required. But if, UAC has been turned OFF by the user, Outlook/VSTO willsearch for the addin entry in HKLM hive. And thus the addin fails.

    In order to solve this problem, the simplest solution is to add addin registry keys in the specific user's hive as well as local machine hive if OS version is Windows Vista. I'm giving simple steps to do that.

    1. In your deployment project, open registry view. In HKLM hive, create exactly same keys and values under Software\CLSID key of HKLM.
    2. For all the entries under your addin GUID entry and addin entry set all properties like those in HKCU hive.
    3. Now for each key and subkey set condition property as "VersionNT >= 600". This specifies version of Windows Vista kernel and thus this set of keys will be only registered when OS is Windows Vista.

    I made changes in my installer project and didn't require any other changes to do. Of course I'm assuming that one has already added the mechanism for granting trust to assemblies. The installer as well as addin works fine for both XP and Vista

    regards,

    Chaitanya

All Replies

  • Friday, June 05, 2009 9:45 AMMike WalkerMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Chaitanya

    The issues you are referring to are all controlled by the MSI Installer asking to Elevate the Permissions of the installation process to allow your Policy and HKLM registry keys to be registered. The Windows Installer runs a "TRUSTED INSTALLER" process that will deal with some of the elevation requirements needed on VISTA.

    To elevate permissions for an installation, open the project (.vdproj) file. In the project file's MsiBootstrapper section, set the RequiresElevation property to True. This property is not made available through the Visual Studio integrated development environment (IDE). Therefore, you must use the project file. For more information, see RequiresElevation Property.

    http://msmvps.com/blogs/carlosq/archive/2008/04/02/mz-tools-articles-series-howto-create-a-setup-for-a-visual-studio-2005-2008-add-in-using-inno-setup.aspx is an article about using another tool which may be easier for you as well.

    You shouldn't need two setup programs as we don't have this but I do use Installshield that makes the elevation switch for MSI a lot easier to find.

    Regards


    Mike Walker MVP - Visual Developer VSTO - Please mark the best replies as Answers !
  • Friday, June 05, 2009 2:43 PMChaitanya Joshi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Mike

    Thanks a lot for your such a prompt reply. Actually the deployment project is automatically created by VSTO Outlook 2003 Addin and it seems that it does not create any .vdproj file. I mean I might be too dumb to find that. There is only single file without extension in the Setup project folder which looks like a conf file for the project. I opened that file and found out "MsiBootstrapper" section. To my disappointment, the property RequiresElevation is not present there. Further when I checked the link you provided for RequiresElevation, it says the property is present in .NET framework 3.5 and above.

    Further how to detect OS version and modify the registry change settings accordingly?

    And thanks for Inno setup but the problem is MSI is required. For the same reason I discarded NSIS as well.
  • Tuesday, July 07, 2009 11:56 AMChaitanya Joshi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Well I got the problem solved without much detour and making some changes in installer project itself.

    On MSDN, you can find the necessary change in registry keys to deploy VSTO addin on Windows Vista when UAC is ON or OFF.

    The registry keys for the plugin are generally located in
    HKCU\Software\Classes\CLSID\<ADDIN-GUID> and
    HKCU\<ADDIN-NAME>
    for single user configuration.

    On Windows Vista, if configuration is same and UAC is ON then above registry settings work and no additional things are required. But if, UAC has been turned OFF by the user, Outlook/VSTO willsearch for the addin entry in HKLM hive. And thus the addin fails.

    In order to solve this problem, the simplest solution is to add addin registry keys in the specific user's hive as well as local machine hive if OS version is Windows Vista. I'm giving simple steps to do that.

    1. In your deployment project, open registry view. In HKLM hive, create exactly same keys and values under Software\CLSID key of HKLM.
    2. For all the entries under your addin GUID entry and addin entry set all properties like those in HKCU hive.
    3. Now for each key and subkey set condition property as "VersionNT >= 600". This specifies version of Windows Vista kernel and thus this set of keys will be only registered when OS is Windows Vista.

    I made changes in my installer project and didn't require any other changes to do. Of course I'm assuming that one has already added the mechanism for granting trust to assemblies. The installer as well as addin works fine for both XP and Vista

    regards,

    Chaitanya
  • Thursday, August 06, 2009 1:30 AMTom Whittaker Jr. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Chaitanya,

    I'm not seeing that problem with my Outlook 2007 VSTO 2005 SE plug-in.

    On Vista 32-bit, it works fine with or without UAC turned on, without installing the HKCU settings also under HKLM.

    I have the Office 2007 autoregister registry entries under HKLM, but nothing else.

    Are you using 64-bit Vista?

    What is different between what you are doing and what I'm doing?
  • Monday, August 24, 2009 4:53 AMChaitanya Joshi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I was using Vista 32 bit only. But the difference I see is in the version of Office and may be in VSTO. I'm not sure but there might be difference in how VSTO registers an Office 2007 add-in and an Office 2003 add-in.

    Sorry for late reply.

    Regards,

    Chaitanya