Package Package Package Package Class

Definition

Provides information about a package.

public sealed class Packagepublic sealed class PackagePublic NotInheritable Class Packagepublic sealed class Package
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Although Package is supported in desktop apps, some members of this class are supported only in Windows Store app. The remarks section will indicate whether a member has any restrictions on its behavior.

Properties

Current Current Current Current

Gets the package for the current app.

public static Package Current { get; }public static Package Current { get; }Public Static ReadOnly Property Current As Packagepublic static Package Current { get; }
Value
Package Package Package Package

The package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

Although Package is supported in desktop apps, this member is supported only in Windows Store app. To access a package object from a desktop app, use PackageManager.

Dependencies Dependencies Dependencies Dependencies

Gets the packages on which the current package depends.

public IVectorView<Package> Dependencies { get; }public IVectorView<Package> Dependencies { get; }Public ReadOnly Property Dependencies As IVectorView<Package>public IVectorView<Package> Dependencies { get; }
Value

The packages on which the current package depends.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

Although Package is supported in desktop apps, this member is supported only in Windows Store app. To access a package's dependencies from a desktop app, use GetPackageInfo.

Description Description Description Description

Gets the description of the package.

public string Description { get; }public string Description { get; }Public ReadOnly Property Description As stringpublic string Description { get; }
Value
string string string string

The description of the package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

This property is only supported for Windows Store app. If you call this property on an instance of a package that was created by any mechanism other than Current, this property returns an empty string ("").

DisplayName DisplayName DisplayName DisplayName

Gets the display name of the package.

public string DisplayName { get; }public string DisplayName { get; }Public ReadOnly Property DisplayName As stringpublic string DisplayName { get; }
Value
string string string string

The display name.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

This property is only supported for Windows Store app. If you call this property on an instance of a package that was created by any mechanism other than Current, this property returns an empty string ("").

Id Id Id Id

Gets the package identity of the current package.

public PackageId Id { get; }public PackageId Id { get; }Public ReadOnly Property Id As PackageIdpublic PackageId Id { get; }
Value
PackageId PackageId PackageId PackageId

The package identity.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

InstallDate InstallDate InstallDate InstallDate

Windows Phone only. Gets the date the application package was installed on the user's phone.

public DateTime InstallDate { get; }public DateTimeOffset InstallDate { get; }Public ReadOnly Property InstallDate As DateTimeOffsetpublic DateTime InstallDate { get; }
Value
DateTime DateTime DateTime DateTime

The date the application package was installed on the user's phone.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Windows Phone 8

If you acquire the Package instance by using the Current property, getting the InstallDate property raises an InvalidCastException. If you want to get the InstallDate property, acquire the Package instance by using the FindPackagesForCurrentPublisher() method.


using Windows.ApplicationModel;

IEnumerable<Package> packages = Windows.Phone.Management.Deployment.InstallationManager.FindPackagesForCurrentPublisher();
Package package = packages.First();
DateTimeOffset packageInstallDate = package.InstallDate;

Windows 10

This API is not implemented and will throw an exception if called.

InstalledDate InstalledDate InstalledDate InstalledDate

Gets the date on which the application package was installed or last updated.

public DateTime InstalledDate { get; }public DateTimeOffset InstalledDate { get; }Public ReadOnly Property InstalledDate As DateTimeOffsetpublic DateTime InstalledDate { get; }
Value
DateTime DateTime DateTime DateTime

The date on which the application package was installed or last updated.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

InstalledLocation InstalledLocation InstalledLocation InstalledLocation

Gets the location of the installed package.

public StorageFolder InstalledLocation { get; }public StorageFolder InstalledLocation { get; }Public ReadOnly Property InstalledLocation As StorageFolderpublic StorageFolder InstalledLocation { get; }
Value
StorageFolder StorageFolder StorageFolder StorageFolder

The location of the installed package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

There are several other ways to refer to the a file in a package.

  • You can just begin a URI with a "/" to refer to the package root. For example: <img src="/file.png" alt="" />
  • You can use the "ms-appx:///" protocol. For example:<img src="ms-appx://packageFullName/file.png" alt="" />
  • You can also omit the package name to let the system fill in the domain, as shown here:

<img src="ms-appx:///file.png" alt="" /> For more info about how to refer to files in an app's package, see How to load file resources.

IsBundle IsBundle IsBundle IsBundle

Indicates whether the package is a bundle package.

public bool IsBundle { get; }public bool IsBundle { get; }Public ReadOnly Property IsBundle As boolpublic bool IsBundle { get; }
Value
bool bool bool bool

A Boolean value that indicates whether the package is a bundle package. TRUE indicates that the package is a bundle package; otherwise FALSE.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsDevelopmentMode IsDevelopmentMode IsDevelopmentMode IsDevelopmentMode

Indicates whether the package is installed in development mode.

public bool IsDevelopmentMode { get; }public bool IsDevelopmentMode { get; }Public ReadOnly Property IsDevelopmentMode As boolpublic bool IsDevelopmentMode { get; }
Value
bool bool bool bool

A Boolean value that indicates whether the package is installed in development mode. TRUE indicates that the package is installed in development mode; otherwise FALSE.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsFramework IsFramework IsFramework IsFramework

Indicates whether other packages can declare a dependency on this package.

public bool IsFramework { get; }public bool IsFramework { get; }Public ReadOnly Property IsFramework As boolpublic bool IsFramework { get; }
Value
bool bool bool bool

True if other packages can declare a dependency on this package; otherwise false.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsOptional IsOptional IsOptional IsOptional

Indicates whether the package is optional.

public bool IsOptional { get; }public bool IsOptional { get; }Public ReadOnly Property IsOptional As boolpublic bool IsOptional { get; }
Value
bool bool bool bool

Returns true if the package is optional; false otherwise.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Optional packages are dependent on another package that must be installed first. For example a map application may have optional geographic area packages.

IsResourcePackage IsResourcePackage IsResourcePackage IsResourcePackage

Indicates whether the package is a resource package.

public bool IsResourcePackage { get; }public bool IsResourcePackage { get; }Public ReadOnly Property IsResourcePackage As boolpublic bool IsResourcePackage { get; }
Value
bool bool bool bool

A Boolean value that indicates whether the package is a resource package. TRUE indicates that the package is a resource package; otherwise FALSE.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Gets the logo of the package.

public Uri Logo { get; }public Uri Logo { get; }Public ReadOnly Property Logo As Uripublic Uri Logo { get; }
Value
Uri Uri Uri Uri

The logo of the package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

This property is only supported for Windows Store app. If you call this property on an instance of a package that was created by any mechanism other than Current, this property will throw an exception.

PublisherDisplayName PublisherDisplayName PublisherDisplayName PublisherDisplayName

Gets the publisher display name of the package.

public string PublisherDisplayName { get; }public string PublisherDisplayName { get; }Public ReadOnly Property PublisherDisplayName As stringpublic string PublisherDisplayName { get; }
Value
string string string string

The publisher display name.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Important

This property is only supported for Windows Store app. If you call this property on an instance of a package that was created by any mechanism other than Current, this property returns an empty string ("").

SignatureKind SignatureKind SignatureKind SignatureKind

How the app package is signed.

public PackageSignatureKind SignatureKind { get; }public PackageSignatureKind SignatureKind { get; }Public ReadOnly Property SignatureKind As PackageSignatureKindpublic PackageSignatureKind SignatureKind { get; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Status Status Status Status

Get the current status of the package for the user.

public PackageStatus Status { get; }public PackageStatus Status { get; }Public ReadOnly Property Status As PackageStatuspublic PackageStatus Status { get; }
Value
PackageStatus PackageStatus PackageStatus PackageStatus

The current status of the package for the user.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

GetAppListEntriesAsync() GetAppListEntriesAsync() GetAppListEntriesAsync() GetAppListEntriesAsync()

Enumerates the packaged apps on the device. Only packaged apps that are registered to the current user are returned.

public IAsyncOperation<IVectorView<AppListEntry>> GetAppListEntriesAsync()public IAsyncOperation<IVectorView<AppListEntry>> GetAppListEntriesAsync()Public Function GetAppListEntriesAsync() As IAsyncOperation( Of IVectorViewAppListEntry )public IAsyncOperation<IVectorView<AppListEntry>> GetAppListEntriesAsync()
Returns

A list of packaged apps along with their display name, description, and logo.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetContentGroupAsync(String) GetContentGroupAsync(String) GetContentGroupAsync(String) GetContentGroupAsync(String)

Prerelease. Provides information about the package content group such as its state, name, whether it is required, and so on.

public IAsyncOperation<PackageContentGroup> GetContentGroupAsync(String name)public IAsyncOperation<PackageContentGroup> GetContentGroupAsync(String name)Public Function GetContentGroupAsync(name As String) As IAsyncOperation( Of PackageContentGroup )public IAsyncOperation<PackageContentGroup> GetContentGroupAsync(String name)
Parameters
name
System.String System.String System.String System.String

The name of the content group to get.

Returns

A PackageContentGroup that contains information such as whether the content group is required, its state, the package associated with the content group, and so on. Returns Null if the named content group is not part of this package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetContentGroupsAsync() GetContentGroupsAsync() GetContentGroupsAsync() GetContentGroupsAsync()

Prerelease. Provides information about all of the package content groups in the app and their state, name, whether they are required, and so on.

public IAsyncOperation<IVector<PackageContentGroup>> GetContentGroupsAsync()public IAsyncOperation<IVector<PackageContentGroup>> GetContentGroupsAsync()Public Function GetContentGroupsAsync() As IAsyncOperation( Of IVectorPackageContentGroup )public IAsyncOperation<IVector<PackageContentGroup>> GetContentGroupsAsync()
Returns

A list of package content group objects.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The returned collection may be empty if the package does not contain any content groups.

GetThumbnailToken() GetThumbnailToken() GetThumbnailToken() GetThumbnailToken()

Windows Phone only. Returns a token that can be used to retrieve the thumbnail image associated with this application package.

public string GetThumbnailToken()public string GetThumbnailToken()Public Function GetThumbnailToken() As stringpublic string GetThumbnailToken()
Returns
string string string string

A token that can be used to retrieve the thumbnail image associated with this application package.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Use the GetSharedFileName method passing the token returned by this method to retrieve the thumbnail image associated with this application package.

Launch(String) Launch(String) Launch(String) Launch(String)

Windows Phone only. Launches the specified application.

public void Launch(String parameters)public void Launch(String parameters)Public Function Launch(parameters As String) As voidpublic void Launch(String parameters)
Parameters
parameters
System.String System.String System.String System.String

The navigation URI that specifies the page to launch and optional parameters. Use an empty string to specify the default page for the app.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The Launch parameter has the same format as the NavigationUri format. The following table shows some examples:

ScenarioLaunch parameterExample
You just want to launch the app with the default page.Specify an empty string.pkg.Launch("");
You want to launch to a particular XAML page.Start with a forward slash (/) followed by the XAML page name.pkg.Launch("/Page1.xaml");
You want to pass parameters to the default page.Start with a question mark (?) followed by name/value pairs. Use an equal sign (=) between the name and value. Separate multiple name/value pairs with an ampersand (&).pkg.Launch("?content=1234&param2=test");
You want to launch to a particular XAML page and pass in parameters.Use a combination of the previous two examples.pkg.Launch("/Page1.xaml?content=1234&param2=test ");
Important

The Launch(String) method only works if it is called from a Windows Phone Silverlight app.

SetInUseAsync(Boolean) SetInUseAsync(Boolean) SetInUseAsync(Boolean) SetInUseAsync(Boolean)

Prerelease. Sets whether the package is in use or not.

public IAsyncOperation<bool> SetInUseAsync(Boolean inUse)public IAsyncOperation<bool> SetInUseAsync(Boolean inUse)Public Function SetInUseAsync(inUse As Boolean) As IAsyncOperation( Of bool )public IAsyncOperation<bool> SetInUseAsync(Boolean inUse)
Parameters
inUse
System.Boolean System.Boolean System.Boolean System.Boolean

True to specify that the package is in use; false otherwise.

Returns

True indicates that the operation was successful; false otherwise.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This API provides a way to indicate whether the app is using an optional package. With this information the system can determine whether servicing the optional package requires shutting down the app or not. This provides a better user experience because the app can mitigate when it is shut down for optional package updates or removals.

By default, all optional packages are in use. Servicing an optional package causes the app to shut down. To avoid shutting down the app when an optional package that is not being used is updated or removed, call this API with inUse set to false.

StageContentGroupsAsync(IIterable<String>) StageContentGroupsAsync(IIterable<String>) StageContentGroupsAsync(IIterable<String>) StageContentGroupsAsync(IIterable<String>)

Prerelease. Put the packages in the specified content groups into the staging queue.

public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names)public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names)Public Function StageContentGroupsAsync(names As IIterable<String>) As IAsyncOperation( Of IVectorPackageContentGroup )public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names)
Parameters
names

The names of the content groups to stage.

Returns

A list of PackageContentGroup objects for each content group specified by the names parameter.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This function completes when all requested groups are staged. The returned list may contain a null element if the named group in that position does not exist. Use PackageContentGroupStaging to observe staging progress.

Be sure to check PackageContentGroupState to verify that the group was successfully staged. Referencing files in a group that is not fully staged may result in unexpected application behavior. Content groups return to the PackageContentGroupState.NotStaged state if the staging operation cannot be completed.

StageContentGroupsAsync(IIterable<String>, Boolean) StageContentGroupsAsync(IIterable<String>, Boolean) StageContentGroupsAsync(IIterable<String>, Boolean) StageContentGroupsAsync(IIterable<String>, Boolean)

Prerelease. Put the packages in the specified content groups into the staging queue; optionally placing the content groups at the head of the queue.

public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names, Boolean moveToHeadOfQueue)public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names, Boolean moveToHeadOfQueue)Public Function StageContentGroupsAsync(names As IIterable<String>, moveToHeadOfQueue As Boolean) As IAsyncOperation( Of IVectorPackageContentGroup )public IAsyncOperation<IVector<PackageContentGroup>> StageContentGroupsAsync(IIterable<String> names, Boolean moveToHeadOfQueue)
Parameters
names

The names of the content groups to stage.

moveToHeadOfQueue
System.Boolean System.Boolean System.Boolean System.Boolean

True to move the content group to the head of the staging queue; false otherwise.

Returns

A list of PackageContentGroup objects for each content group specified by the names parameter.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This function completes when all requested groups are staged. The returned list may contain a null element if the named group in that position does not exist. Use PackageContentGroupStaging to observe staging progress.

Be sure to check PackageContentGroupState to verify that the group was successfully staged. Referencing files in a group that is not fully staged may result in unexpected application behavior. Content groups return to the PackageContentGroupState.NotStaged state if the staging operation cannot be completed.

VerifyContentIntegrityAsync() VerifyContentIntegrityAsync() VerifyContentIntegrityAsync() VerifyContentIntegrityAsync()

Ensures that the package has not been modified or tampered with before being loaded.

public IAsyncOperation<bool> VerifyContentIntegrityAsync()public IAsyncOperation<bool> VerifyContentIntegrityAsync()Public Function VerifyContentIntegrityAsync() As IAsyncOperation( Of bool )public IAsyncOperation<bool> VerifyContentIntegrityAsync()
Returns

true - the package has not been modified; false otherwise.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This function only verifies that the package's contents have not been modified. It does not verify the package's status, origin, and so on.