Package Package Package Package Class

Provides information about a package.

Syntax

Declaration

public sealed class Packagepublic sealed class PackagePublic NotInheritable Class Package

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 summary

Gets the package for the current app.

Gets the packages on which the current package depends.

Gets the description of the package.

Gets the display name of the package.

Gets the package identity of the current package.

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

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

Gets the location of the installed package.

Indicates whether the package is a bundle package.

Indicates whether the package is installed in development mode.

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

Indicates whether the package is optional.

Indicates whether the package is a resource package.

Gets the logo of the package.

Gets the publisher display name of the package.

How the app package is signed.

Get the current status of the package for the user.

Methods summary

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

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

Windows Phone only. Launches the specified application.

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

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 Package

    Property Value

    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>

    Property Value

    • The packages on which the current package depends.

    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 string

    Property Value

    • string
      string
      string
      string

      The description of the package.

    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 string

    Property Value

    • string
      string
      string
      string

      The display name.

    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 PackageId

    Property Value

  • 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 DateTime InstallDate { get; }Public ReadOnly Property InstallDate As DateTime

    Property Value

    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 DateTime InstalledDate { get; }Public ReadOnly Property InstalledDate As DateTime

    Property Value

  • InstalledLocation
    InstalledLocation
    InstalledLocation
    InstalledLocation

    Gets the location of the installed package.

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

    Property Value

    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 bool

    Property 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.

  • 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 bool

    Property 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.

  • 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 bool

    Property Value

    • bool
      bool
      bool
      bool

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

  • IsOptional
    IsOptional
    IsOptional
    IsOptional

    Indicates whether the package is optional.

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

    Property Value

    • bool
      bool
      bool
      bool

      Returns true if the package is optional; false otherwise.

    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 bool

    Property 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.

  • 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 string

    Property Value

    • string
      string
      string
      string

      The publisher display name.

    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 PackageSignatureKind

    Property Value

  • 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 PackageStatus

    Property Value

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<AppListEntry>> GetAppListEntriesAsync()public IAsyncOperation<AppListEntry>> GetAppListEntriesAsync()Public Function GetAppListEntriesAsync() As IAsyncOperation( Of AppListEntry )

    Returns

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

  • 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 string

    Returns

    • string
      string
      string
      string

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

    Remarks

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

  • Launch(System.String)
    Launch(System.String)
    Launch(System.String)
    Launch(System.String)

    Windows Phone only. Launches the specified application.

    public void Launch(System.String)public void Launch(System.String)Public Function Launch(System.String) As void

    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.

    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(System.String) method only works if it is called from a Windows Phone Silverlight app.

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

    Returns

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

    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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.StaticAttribute

Details

Assembly

Windows.ApplicationModel.dll