Skip to main content
PackageId class

Provides package identification info, such as name, version, and publisher.

Syntax


var packageId = Windows.ApplicationModel.Package.current.id;

public sealed class PackageId

Public NotInheritable Class PackageId

public ref class PackageId sealed 

Members

The PackageId class has these types of members:

Properties

The PackageId class has these properties.

PropertyAccess typeDescription

Architecture

Read-only

Gets the processor architecture for which the package was created.

Author

Read-only

Windows Phone only. Gets the value of the Author attribute for the specified application package.

FamilyName

Read-only

Gets the family name of the package.

FullName

Read-only

Gets the full name of the package.

Name

Read-only

Gets the name of the package.

ProductId

Read-only

Windows Phone only. Gets the value of the ProductID attribute associated with this application package.

Publisher

Read-only

Gets the publisher of the package.

PublisherId

Read-only

Gets the publisher ID of the package.

ResourceId

Read-only

Gets the resource ID of the package.

Version

Read-only

Gets the package version info.

 

Examples

Use the Package.Current | current property to get the package for the current app. Use the Package.Id | id property to get the package ID. This example gets package identity information by using members of the Package and PackageId classes.


var package = Windows.ApplicationModel.Package.current;
var packageId = package.id;
var version = packageId.version;

var output = [ "Name: \"" + packageId.name + "\"",
               "Version: " + version.major + "." + version.minor + "." 
                           + version.build + "." + version.revision,
               "Architecture: " + packageId.architecture,
               "ResourceId: \"" + packageId.resourceId + "\"",
               "Publisher: \"" + packageId.publisher + "\"",
               "PublisherId: \"" + packageId.publisherId + "\"",
               "FullName: \"" + packageId.fullName + "\"",
               "FamilyName: \"" + packageId.familyName + "\"",
               "IsFramework: " + package.isFramework ];

using Windows.ApplicationModel;

Package package = Package.Current;
PackageId packageId = package.Id;
PackageVersion version = packageId.Version;

String output = String.Format(
                   "Name: \"{0}\"\n" +
                   "Version: {1}.{2}.{3}.{4}\n" +
                   "Architecture: {5}\n" +
                   "ResourceId: \"{6}\"\n" +
                   "Publisher: \"{7}\"\n" +
                   "PublisherId: \"{8}\"\n" +
                   "FullName: \"{9}\"\n" +
                   "FamilyName: \"{10}\"\n" +
                   "IsFramework: {11}",
                   packageId.Name,
                   version.Major, version.Minor, version.Build, version.Revision,
                   packageId.Architecture,
                   packageId.ResourceId,
                   packageId.Publisher,
                   packageId.PublisherId,
                   packageId.FullName,
                   packageId.FamilyName,
                   package.IsFramework);

Dim package As Windows.ApplicationModel.Package = Windows.ApplicationModel.Package.Current
Dim packageId As Windows.ApplicationModel.PackageId = package.Id
Dim version As Windows.ApplicationModel.PackageVersion = packageId.Version

Dim output As String = String.Format(
    "Name: ""{0}""" & VBCrLf & 
    "Version: {1}.{2}.{3}.{4}" & VBCrLf & 
    "Architecture: {5}" & VBCrLf & 
    "ResourceId: ""{6}""" & VBCrLf & 
    "Publisher: ""{7}""" & VBCrLf & 
    "PublisherId: ""{8}""" & VBCrLf & 
    "FullName: ""{9}""" & VBCrLf & 
    "FamilyName: ""{10}""" & VBCrLf & 
    "IsFramework: {11}", 
    packageId.Name, 
    version.Major, version.Minor, version.Build, version.Revision, 
    packageId.Architecture, 
    packageId.ResourceId, 
    packageId.Publisher, 
    packageId.PublisherId, 
    packageId.FullName, 
    packageId.FamilyName, 
    package.IsFramework)

Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::ApplicationModel::PackageId^ packageId = package->Id;
Windows::ApplicationModel::PackageVersion version = packageId->Version;

Platform::String^ output = "Name: \"" + packageId->Name + "\"\n" +
                        "Version: " + VersionString(version) + "\n" +
                   "Architecture: " + ArchitectureString(packageId->Architecture) + "\n" +
                     "ResourceId: \"" + packageId->ResourceId + "\"\n" +
                      "Publisher: \"" + packageId->Publisher + "\"\n" +
                    "PublisherId: \"" + packageId->PublisherId + "\"\n" +
                       "FullName: \"" + packageId->FullName + "\"\n" +
                     "FamilyName: \"" + packageId->FamilyName + "\"\n" +
                    "IsFramework: " + package->IsFramework.ToString();

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel
Windows::ApplicationModel [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8

Namespace

Windows.ApplicationModel
Windows::ApplicationModel [C++]

Metadata

Windows.winmd

Attributes

[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Version(0x06020000)]

See also

Object
Samples
App package information sample
Concepts
Packaging apps
Reference
Package.Current
Package.Id
App package information sample (Windows 10)