.NET Framework Class Library
ApplicationId Class

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

Inheritance Hierarchy
SystemObject
  SystemApplicationId

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Syntax
<[%$TOPIC/70wh3x02_en-us_VS_110_2_0_0_0_0%]> _
<[%$TOPIC/70wh3x02_en-us_VS_110_2_0_0_0_1%](True)> _
Public NotInheritable Class ApplicationId
[[%$TOPIC/70wh3x02_en-us_VS_110_2_0_1_0_0%]]
[[%$TOPIC/70wh3x02_en-us_VS_110_2_0_1_0_1%](true)]
public sealed class ApplicationId
[[%$TOPIC/70wh3x02_en-us_VS_110_2_0_2_0_0%]]
[[%$TOPIC/70wh3x02_en-us_VS_110_2_0_2_0_1%](true)]
public ref class ApplicationId sealed
[<[%$TOPIC/70wh3x02_en-us_VS_110_2_0_3_0_0%]>]
[<[%$TOPIC/70wh3x02_en-us_VS_110_2_0_3_0_1%]>]
[<[%$TOPIC/70wh3x02_en-us_VS_110_2_0_3_0_2%](true)>]
type ApplicationId =  class end

The ApplicationId type exposes the following members.

Constructors
  NameDescription
Public method ApplicationIdInitializes a new instance of the ApplicationId class.
Top
Properties
  NameDescription
Public property CultureGets a string representing the culture information for the application.
Public property NameGets the name of the application.
Public property ProcessorArchitectureGets the target processor architecture for the application.
Public property PublicKeyTokenGets the public key token for the application.
Public property VersionGets the version of the application.
Top
Methods
  NameDescription
Public method CopyCreates and returns an identical copy of the current application identity.
Public method EqualsDetermines whether the specified ApplicationId object is equivalent to the current ApplicationId. (Overrides ObjectEquals(Object).)
Public method GetHashCodeGets the hash code for the current application identity. (Overrides ObjectGetHashCode.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method ToStringCreates and returns a string representation of the application identity. (Overrides ObjectToString.)
Top
Remarks

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.

Examples

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 = " + _
            AppDomain.CurrentDomain.ActivationContext.Identity.FullName)
        Console.WriteLine("Code base = " + _
            AppDomain.CurrentDomain.ActivationContext.Identity.CodeBase)
        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 = " + _
            asi.ApplicationId.Culture.ToString())
        End If
        Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + _
            asi.ApplicationId.ProcessorArchitecture)
        Console.WriteLine("ApplicationId.Version property = " + _
            asi.ApplicationId.Version.ToString())
        ' 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 
        Console.Read()

    End Sub 'Main

    Public Sub Run() 
        Main(New String() {})  
    End Sub 'Run
End Class 'Program
using System;
using System.Collections;
using System.Text;
using System.Security.Policy;
using System.Reflection;
using System.Security;
using System.Security.Permissions;

namespace ActivationContextSample
{
    public class Program : MarshalByRefObject
    {
        [SecurityPermission(SecurityAction.Demand, ControlDomainPolicy = true)]
        public static void Main(string[] args)
        {
            Console.WriteLine("Full name = " +
                AppDomain.CurrentDomain.ActivationContext.Identity.FullName);
            Console.WriteLine("Code base = " +
                AppDomain.CurrentDomain.ActivationContext.Identity.CodeBase);
            ApplicationSecurityInfo asi = new ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext);

            Console.WriteLine("ApplicationId.Name property = " + asi.ApplicationId.Name);
            if (asi.ApplicationId.Culture != null)
                Console.WriteLine("ApplicationId.Culture property = " + asi.ApplicationId.Culture.ToString());
            Console.WriteLine("ApplicationId.ProcessorArchitecture property = " + asi.ApplicationId.ProcessorArchitecture);
            Console.WriteLine("ApplicationId.Version property = " + asi.ApplicationId.Version);
            // To display the value of the public key, enumerate the Byte array for the property.
            Console.Write("ApplicationId.PublicKeyToken property = ");
            byte[] pk = asi.ApplicationId.PublicKeyToken;
            for (int i = 0; i < pk.GetLength(0); i++)
                Console.Write("{0:x}", pk[i]);

            Console.Read();
        }

        public void Run()
        {
            Main(new string[] { });
            Console.ReadLine();
        }
    }
}
Version Information

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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