Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ServerDocument.DeploymentManifestUrl Property

Gets or sets the URL of the deployment manifest for the customization that is associated with the document.

Namespace:  Microsoft.VisualStudio.Tools.Applications
Assembly:  Microsoft.VisualStudio.Tools.Applications.ServerDocument (in Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll)

public Uri DeploymentManifestUrl { get; set; }

Property Value

Type: System.Uri
A URL that specifies the name and location of the deployment manifest for the customization that is associated with the document.

Set this property to a new URL if you move the deployment manifest for a customization to a different location, and you want the document to locate customization updates from the new location. If you set this property, the URL must point to a deployment manifest for the customization that is already associated with the document.

You cannot use this property to associate a new customization with a document. To add a customization to an uncustomized document, use the AddCustomization method. To add a different customization to a customized document, first use the RemoveCustomization method to remove the current customization, and then use the AddCustomization method.

Getting the URL in Applications that Target the .NET Framework 3.5

When you use the ServerDocument class in the Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll assembly in an application that targets the .NET Framework 3.5, the DeploymentManifestUrl property returns the current deployment manifest URL only if the documentation-level customization is installed on the computer where you are running the application. Otherwise, this property returns null.

If you need to get the deployment manifest URL of a document-level customization that is not installed on the computer where you are running the application (for example, on a server where a document-level customization is published), target the .NET Framework 4 in the application, reference the Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll assembly, and use the ServerDocument class in that assembly.

The following code example uses the ServerDocument(String) constructor to create a new ServerDocument that loads a specified document. The example then displays the URL of the deployment manifest for the customization that is attached to the document.

This example requires:

  • A console application project or some other non-Office project.

  • References to the following assemblies:

    • Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.dll (if the project targets the .NET Framework 4 or the .NET Framework 4.5).

      or

    • Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll and Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll (if the project targets the .NET Framework 3.5).

  • Imports (for Visual Basic) or using (for C#) statements for Microsoft.VisualStudio.Tools.Applications and Microsoft.VisualStudio.Tools.Applications.Runtime namespaces at the top of your code file.

private void CreateServerDocumentFromPath(string documentPath)
{
    int runtimeVersion = 0;
    ServerDocument serverDocument1 = null;

    try
    {
        runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath);
        if (runtimeVersion == 3)
        {
            serverDocument1 = new ServerDocument(documentPath);
            MessageBox.Show("The URL of the deployment manifest is: \n" +
                serverDocument1.DeploymentManifestUrl.ToString());
        }
    }
    catch (System.IO.FileNotFoundException)
    {
        System.Windows.Forms.MessageBox.Show("The specified document does not exist.");
    }
    catch (UnknownCustomizationFileException)
    {
        System.Windows.Forms.MessageBox.Show("The specified document has a file " +
            "extension that is not supported by Visual Studio Tools for Office.");
    }
    finally
    {
        if (serverDocument1 != null)
            serverDocument1.Close();
    }
}

Show:
© 2015 Microsoft