PackageId class

Applies to Windows and Windows Phone

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

Syntax


public sealed class PackageId

Attributes

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

Members

The PackageId class has these types of members:

Properties

The PackageId class has these properties.

PropertyAccess typeDescription

Architecture

Read-onlyGets the processor architecture for which the package was created.

Author

Read-onlyWindows Phone only. Gets the value of the Author attribute for the specified application package.

FamilyName

Read-onlyGets the family name of the package.

FullName

Read-onlyGets the full name of the package.

Name

Read-onlyGets the name of the package.

ProductId

Read-onlyWindows Phone only. Gets the value of the ProductID attribute associated with this application package.

Publisher

Read-onlyGets the publisher of the package.

PublisherId

Read-onlyGets the publisher ID of the package.

ResourceId

Read-onlyGets the resource ID of the package.

Version

Read-onlyGets 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.



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);

Requirements

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

See also

Samples
App package information sample
Concepts
App packages and deployment
Reference
Package.Current
Package.Id

 

 

Show:
© 2015 Microsoft