Click here to Skip to main content
Licence CPOL
First Posted 20 Apr 2007
Views 28,945
Bookmarked 11 times

Developing Outlook 2003 Addin on VSTO SE under Vista + 2007 Office

By | 20 Apr 2007 | Article
How to compile and debug 2003 VSTO Addins under Vista + 2007 Office

Introduction

If you want to know how to compile and debug VSTO SE Outlook 2003 Addin on a computer with the configuration: Vista+Office 2007, read this article.

Steps

Install Office 2003 PIA and Office 2007 PIA on the same computer

  1. Install Office 2003 in trial mode
  2. Install Office 2003 PIA (we need 1. to install 2003 PIA)
  3. Uninstall Office 2003
  4. Install Office 2007
  5. Create 2003 Addin in Visual Studio project

    Change 2003 COM reference to 2003 PIA in .csproj for "none error" compilation

  6. Open project file in text editor and find this fragment:

    <!--
    This section specifies COM References for the project 
    (managed assemblies that wrap unmanaged typelibs (tlb)). 
    This is the equivalent of choosing "Add Reference->Com Reference" 
    in the IDE.
    -->
    <ItemGroup>
        <COMReference Include="Microsoft.Office.Core">
            <Guid>{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}</Guid>
            <VersionMajor>2</VersionMajor>
            <VersionMinor>3</VersionMinor>
            <WrapperTool>primary</WrapperTool>
        </COMReference>
        <COMReference Include="Outlook">
            <Guid>{00062FFF-0000-0000-C000-000000000046}</Guid>
            <VersionMajor>9</VersionMajor>
            <VersionMinor>2</VersionMinor>
            <WrapperTool>primary</WrapperTool>
        </COMReference>
        <COMReference Include="stdole">
            <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
            <VersionMajor>2</VersionMajor>
            <VersionMinor>0</VersionMinor>
            <Lcid>0</Lcid>
            <WrapperTool>primary</WrapperTool>
            <Isolated>False</Isolated>
        </COMReference>
    </ItemGroup>
    

  7. Replace found fragment with:

    <!--
    This section specifies COM References for the project 
    (managed assemblies that wrap unmanaged typelibs (tlb)). 
    This is the equivalent of choosing "Add Reference->Com Reference" 
    in the IDE.
    -->
    <ItemGroup>
        <Reference Include="Microsoft.Office.Interop.Outloo<wbr />k, 
            Version=11.0.0.0, Culture=neutral, 
            PublicKeyToken=71e9bce111e9429c" />
        <Reference Include="Office, Version=11.0.0.0, 
            Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
        <Reference Include="stdole, Version=7.0.3300.0, 
            Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <SpecificVersion>False</SpecificVersion>
        </Reference>
    </ItemGroup>
    

  8. Save and now we have a 2003 Addin, which may be compiled under Vista+2007 Office and may be run under 2003 Office.
    Note: Be careful, "do not" set <SpecificVersion>False</SpecificVersion> for Office and Outlook DLL, because if you do it, your Addin will not run under 2003 Office.

    Turn on Debug Capability

  9. Now, all is fine, but you can't debug 2003 Addin under 2007 Office. So for debug capability, in the project file, you need to change code which is in the tag <ProjectExtensions> with fragment code from Outlook 2007 Addin project.

    <!-- 
    This section defines VSTO properties that describe 
    the host-changable project properties. 
    --> 
    <ProjectExtensions> 
      <VisualStudio> 
        <FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}"> 
          <ProjectProperties HostName="Outlook" 
        HostPackage="{D53BAEDE-5B63-42BE-8267-3DED11EDC582}" 
        ApplicationType="Outlook" Language="cs" TemplatesPath="" 
        DebugInfoExeName=
       "#Software\Microsoft\Office\12.0\Outlook\InstallRoot\Path#Outlook.exe" 
        AddItemTemplatesGuid="{147FB6A7-F239-4523-AE65-B6A4E49B361F}" /> 
            <Host Name="Outlook" 
            GeneratedCodeNamespace="OutlookAddIn3" IconIndex="0"> 
            <HostItem Name="ThisAddIn" Code="ThisAddIn.cs" 
            CanonicalName="ThisAddIn" CanActivate="false" 
            IconIndex="1" Blueprint="ThisAddIn.Designer.xml" 
            GeneratedCode="ThisAddIn.Designer.cs" /> 
            </Host> 
        <ProjectClient> 
          <VSTO_CompatibleProducts ErrorProduct=
          "This project requires Microsoft Office Outlook 2007, 
          but this application is not installed." 
          ErrorPIA="This project references the primary interop assembly 
          for Microsoft Office Outlook 2007, but this primary interop 
          assembly is not installed."> 
          <Product Code="{XX12XXXX-XXXX-XXXX-X000-X000000FF1CE}" 
          Feature="OUTLOOKFiles" PIAFeature="Outlook_PIA" /> 
          </VSTO_CompatibleProducts> 
          </ProjectClient> 
        </FlavorProperties> 
      </VisualStudio> 
    </ProjectExtensions>
    

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Paul Dedyul'kin

Web Developer

Russian Federation Russian Federation

Member

Developer

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionDeveloping Outlook 2003 Addin on VSTO SE under Vista + 2007 Office PinmemberMartin Pacheco5:05 27 Nov '09  
GeneralGlobalAppointmentId Pinmember248912822:01 9 Sep '09  
GeneralOutlook Addin running on both Outlook 2003 and 2007 Pinmemberpakistan0:30 4 Aug '08  
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 PinmemberPaul Dedyul'kin3:46 4 Aug '08  
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 Pinmemberpakistan3:18 11 Aug '08  
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 Pinmemberrcoffee4:58 10 Mar '09  
GeneralFeedback needed: Open-source VSTO add-in to send large files from Outlook released on Codeplex Pinmemberjlchereau9:20 2 May '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 20 Apr 2007
Article Copyright 2007 by Paul Dedyul'kin
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid