다음을 통해 공유


GetManifestCompletedEventArgs.ApplicationManifest Property

Definition

Gets the ClickOnce application manifest for this deployment.

public:
 property System::Xml::XmlReader ^ ApplicationManifest { System::Xml::XmlReader ^ get(); };
public System.Xml.XmlReader ApplicationManifest { get; }
member this.ApplicationManifest : System.Xml.XmlReader
Public ReadOnly Property ApplicationManifest As XmlReader

Property Value

An XmlReader representing the application manifest.

Examples

The following code example shows how to examine an application manifest from within a GetManifestCompleted event handler to determine whether the application requires full trust by default.

private bool CheckForFullTrust(XmlReader appManifest)
{
    if (appManifest == null)
    {
        throw (new ArgumentNullException("appManifest cannot be null."));
    }

    XAttribute xaUnrestricted =
        XDocument.Load(appManifest)
            .Element("{urn:schemas-microsoft-com:asm.v1}assembly")
            .Element("{urn:schemas-microsoft-com:asm.v2}trustInfo")
            .Element("{urn:schemas-microsoft-com:asm.v2}security")
            .Element("{urn:schemas-microsoft-com:asm.v2}applicationRequestMinimum")
            .Element("{urn:schemas-microsoft-com:asm.v2}PermissionSet")
            .Attribute("Unrestricted"); // Attributes never have a namespace

    if (xaUnrestricted != null)
        if (xaUnrestricted.Value == "true")
            return true;

    return false;
}
Private Function CheckForFullTrust(ByVal appManifest As XmlReader) As Boolean
    Dim isFullTrust As Boolean = False

    If (appManifest Is Nothing) Then
        Throw New ArgumentNullException("appManifest cannot be null.")
    End If

    Dim xaUnrestricted As XAttribute
    xaUnrestricted = XDocument.Load(appManifest) _
        .Element("{urn:schemas-microsoft-com:asm.v1}assembly") _
        .Element("{urn:schemas-microsoft-com:asm.v2}trustInfo") _
        .Element("{urn:schemas-microsoft-com:asm.v2}security") _
        .Element("{urn:schemas-microsoft-com:asm.v2}applicationRequestMinimum") _
        .Element("{urn:schemas-microsoft-com:asm.v2}PermissionSet") _
        .Attribute("Unrestricted")  ' Attributes never have a namespace


    If xaUnrestricted Then
        If xaUnrestricted.Value = "true" Then
            Return True
        End If
    End If

    Return False
End Function

Remarks

You can use this variable to grab any information you need from the application manifest, such as a list of dependencies, trust information, and so on. For more information on the structure of this document, see ClickOnce Application Manifest.

Applies to