Click here to Skip to main content
15,881,882 members
Articles / Productivity Apps and Services / Microsoft Office
Article

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

Rate me:
Please Sign up or sign in to vote.
2.62/5 (7 votes)
20 Apr 2007CPOL 49.1K   11   7
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:

    XML
    <!--
    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:

    XML
    <!--
    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.

    XML
    <!-- 
    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)


Written By
Web Developer
Russian Federation Russian Federation
Developer

Comments and Discussions

 
QuestionDeveloping Outlook 2003 Addin on VSTO SE under Vista + 2007 Office Pin
Martin Pacheco27-Nov-09 5:05
Martin Pacheco27-Nov-09 5:05 
GeneralGlobalAppointmentId Pin
24891289-Sep-09 22:01
24891289-Sep-09 22:01 
GeneralOutlook Addin running on both Outlook 2003 and 2007 Pin
pakistan4-Aug-08 0:30
pakistan4-Aug-08 0:30 
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 Pin
Paul Dedyul'kin4-Aug-08 3:46
Paul Dedyul'kin4-Aug-08 3:46 
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 Pin
pakistan11-Aug-08 3:18
pakistan11-Aug-08 3:18 
GeneralRe: Outlook Addin running on both Outlook 2003 and 2007 Pin
rcoffee10-Mar-09 4:58
rcoffee10-Mar-09 4:58 
I think this error is from trying to open the project in Visual Studio 2005. You need Visual Studio 2008
GeneralFeedback needed: Open-source VSTO add-in to send large files from Outlook released on Codeplex Pin
jlchereau2-May-08 9:20
jlchereau2-May-08 9:20 

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

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