Export (0) Print
Expand All

ApplicationId Class

Contains information used to uniquely identify a manifest-based application. This class cannot be inherited.


Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class ApplicationId

The ApplicationId type exposes the following members.

Public methodApplicationIdInitializes a new instance of the ApplicationId class.

Public propertyCultureGets a string representing the culture information for the application.
Public propertyNameGets the name of the application.
Public propertyProcessorArchitectureGets the target processor architecture for the application.
Public propertyPublicKeyTokenGets the public key token for the application.
Public propertyVersionGets the version of the application.

Public methodCopyCreates and returns an identical copy of the current application identity.
Public methodEqualsDetermines whether the specified ApplicationId object is equivalent to the current ApplicationId. (Overrides Object.Equals(Object).)
Public methodGetHashCodeGets the hash code for the current application identity. (Overrides Object.GetHashCode.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringCreates and returns a string representation of the application identity. (Overrides Object.ToString.)

An application identity consists of the publisher's public key, the application name, the target processor architecture, the application culture, and the application version. The application identity properties values correspond to information contained in the application manifest. For more information about the application manifest, see ClickOnce Application Manifest.

ApplicationId is used by the ApplicationSecurityInfo class to identify a manifest-based application.

The following code example displays the ApplicationId properties by obtaining the ApplicationId from an ApplicationSecurityInfo instance created using the ActivationContext for the currently executing manifest-based application.

Imports System
Imports System.Collections
Imports System.Text
Imports System.Security.Policy
Imports System.Reflection
Imports System.Security
Imports System.Security.Permissions

Public Class Program
    Inherits MarshalByRefObject
    <SecurityPermission(SecurityAction.Demand, ControlDomainPolicy:=true)> _
    Public Shared Sub Main(ByVal args() As String) 
        Console.WriteLine("Full name = " + _
        Console.WriteLine("Code base = " + _
        Dim asi As New ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext)     
        Console.WriteLine("ApplicationId.Name property = " + asi.ApplicationId.Name)
        If Not (asi.ApplicationId.Culture Is Nothing) Then
            Console.WriteLine("ApplicationId.Culture property = " + _
        End If
        Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + _
        Console.WriteLine("ApplicationId.Version property = " + _
        ' To display the value of the public key, enumerate the Byte array for the property.
        Console.Write("ApplicationId.PublicKeyToken property = ")
        Dim pk As Byte() = asi.ApplicationId.PublicKeyToken
        Dim i As Integer 
        For i = 0 To (pk.GetLength(0))
            Console.Write("{0:x}", pk(i))
        Next i 

    End Sub 'Main

    Public Sub Run() 
        Main(New String() {})  
    End Sub 'Run
End Class 'Program

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft