Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
 How to: Change the Path to the Depl...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Tools for the Microsoft Office System
How to: Change the Path to the Deployment Manifest Programmatically

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

You can use the object model in the Microsoft Visual Studio 2005 Tools for the Microsoft Office System runtime to programmatically update the application manifest that is embedded in a document that is part of a document-level customization. Generally this is not necessary, because there is another model for updating manifests that involves modifying XML files that are generated by the Publish Wizard. For more information, see How to: Change the Location of Document-Level Customizations.

You must put the code for manipulating the object model in a new project (not your Visual Studio Tools for Office solution)—for example, in a console application or ASP.NET page. Visual Studio Tools for Office includes a sample that demonstrates how to create a tool that can be used to edit the embedded application manifest. For more information, see Application Manifest Editor Sample.

NoteNote

This topic does not apply to application-level add-ins, because they do not use embedded application manifests. To change the path to the deployment manifest of an add-in, use a text editor to update the application manifest that is on the client computer. For more information, see Application Manifests for Office Solutions. For more information about application-level add-ins and document-level customizations, see Office Solutions Architecture Overview.

To change the path to the deployment manifest programmatically

  1. Create a new project to change the manifest file in the Office document. This project can be of any type—for example, a command line solution.

  2. Add a reference to Microsoft.VisualStudio.Tools.Applications.Runtime to this project.

  3. Add an Imports or using statement for the runtime to the top of your code file:

    Visual Basic
    Imports Microsoft.VisualStudio.Tools.Applications.Runtime
    
    C#
    using Microsoft.VisualStudio.Tools.Applications.Runtime;
    
  4. Create an instance of ServerDocument, passing in the solution document, and then assign the new deployment manifest path to the DeployManifestPath property:

    Visual Basic
    Dim sd As ServerDocument = Nothing
    Try
        sd = New ServerDocument("C:\Documents\SolutionDocument.doc")
        sd.AppManifest.DeployManifestPath = _
            "\\NewServer\ShareFolder\SolutionDocument.application"
    
    C#
    ServerDocument sd = null;
    try
    {
        sd = new ServerDocument(@"C:\Documents\SolutionDocument.doc");
        sd.AppManifest.DeployManifestPath = 
            @"\\NewServer\ShareFolder\SolutionDocument.application";
    
  5. Save your changes and close the document:

    Visual Basic
        sd.Save()
    
    Finally
        If Not sd Is Nothing Then
            sd.Close()
        End If
    End Try
    
    C#
        sd.Save();
    }
    finally
    {
        if (sd != null)
        {
            sd.Close();
        }
    }
    

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker