Compartir a través de


ServerDocument.DeploymentManifestUrl Property

Definition

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

public:
 property Uri ^ DeploymentManifestUrl { Uri ^ get(); void set(Uri ^ value); };
public Uri DeploymentManifestUrl { get; set; }
member this.DeploymentManifestUrl : Uri with get, set
Public Property DeploymentManifestUrl As Uri

Property Value

Uri

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

Examples

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();
    }
}
Private Sub CreateServerDocumentFromPath(ByVal documentPath As String)
    Dim runtimeVersion As Integer = 0
    Dim serverDocument1 As ServerDocument = Nothing

    Try
        runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath)
        If runtimeVersion = 3 Then
            serverDocument1 = New ServerDocument(documentPath)
            MessageBox.Show("The URL of the deployment manifest is: " & vbLf & _
                serverDocument1.DeploymentManifestUrl.ToString())
        End If

    Catch ex As System.IO.FileNotFoundException
        System.Windows.Forms.MessageBox.Show("The specified document does not exist.")
    Catch ex As 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 Not (serverDocument1 Is Nothing) Then
            serverDocument1.Close()
        End If
    End Try
End Sub

Remarks

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.

Applies to