PackageManager PackageManager PackageManager Class

Definition

Manages the software available to a user.

public : sealed class PackageManager : IPackageManager, IPackageManager2, IPackageManager3, IPackageManager4, IPackageManager5
public sealed class PackageManager : IPackageManager, IPackageManager2, IPackageManager3, IPackageManager4, IPackageManager5
Public NotInheritable Class PackageManager Implements IPackageManager, IPackageManager2, IPackageManager3, IPackageManager4, IPackageManager5
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Constructors

PackageManager() PackageManager() PackageManager()

Creates and initializes a new instance of the object.

public : PackageManager()
public PackageManager()
Public Sub New()

Properties

DebugSettings DebugSettings DebugSettings

Get the debugging settings for package deployment.

public : PackageManagerDebugSettings DebugSettings { get; }
public PackageManagerDebugSettings DebugSettings { get; }
Public ReadOnly Property DebugSettings As PackageManagerDebugSettings
Value
PackageManagerDebugSettings PackageManagerDebugSettings PackageManagerDebugSettings

The debugging settings for package deployment.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Methods

AddPackageAsync(Uri, IIterable, DeploymentOptions) AddPackageAsync(Uri, IIterable, DeploymentOptions) AddPackageAsync(Uri, IIterable, DeploymentOptions)

Adds a package (the main package) and its dependency packages for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
Public Function AddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The Uri of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The Uris of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration. ForceApplicationShutdown and None are the only valid options for this method. Specifying any other option results in an E_INVALIDARG return value.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

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

Examples

The following example uses the PackageManager.AddPackageAsync method to install a package that has no dependencies or whose dependencies are already installed. Note that the path of the main package is passed as an argument in the example. AddPackageAsync returns an object that can be used to manage the asynchronous operation. The example uses the Completed property to set the delegate and checks the Status property to determine the status of the deployment operation. If the status is Error, the example calls the GetResults method to get additional error information.

using Windows.Foundation;
using Windows.Management.Deployment;

public static int Main(string[] args)
{
    string inputPackageUri = args[0];
    int returnValue=0;

    Uri packageUri = new Uri(inputPackageUri);            

    PackageManager packageManager = new PackageManager();

    IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> deploymentOperation = 
        packageManager.AddPackageAsync(
            packageUri, 
            null, 
            DeploymentOptions.None);

    // This event is signaled when the operation completes
    ManualResetEvent opCompletedEvent = new ManualResetEvent(false); 

    // Define the delegate using a statement lambda
    deploymentOperation.Completed = (depProgress, status) => { opCompletedEvent.Set(); };

    // Wait until the operation completes
    opCompletedEvent.WaitOne();

    // Check the status of the operation
    if (deploymentOperation.Status == AsyncStatus.Error)
    {
        DeploymentResult deploymentResult = deploymentOperation.GetResults();
        Console.WriteLine("Error code: {0}", deploymentOperation.ErrorCode);
        Console.WriteLine("Error text: {0}", deploymentResult.ErrorText);
        returnValue = 1;
    }
    else if (deploymentOperation.Status == AsyncStatus.Canceled)
    {
        Console.WriteLine("Installation canceled");
    }
    else if (deploymentOperation.Status == AsyncStatus.Completed)
    {
        Console.WriteLine("Installation succeeded");
    }
    else
    {
        returnValue = 1;
        Console.WriteLine("Installation status unknown");
    }

    return returnValue;
}

using namespace Windows::Foundation;
using namespace Windows::Management::Deployment;

[STAThread]
int __cdecl main(Platform::Array<String^>^ args)
{  
    String^ inputPackageUri = args[1];
    int returnValue=0;

    Uri^ packageUri = ref new Uri(inputPackageUri);

    PackageManager^ packageManager = ref new PackageManager();

    auto deploymentOperation = packageManager->AddPackageAsync(
        packageUri, 
        nullptr, 
        DeploymentOptions::None);

    DeploymentResult^ deploymentOperationResult;

    // This event is signaled when the operation completes
    opCompletedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

    // Define the delegate
    deploymentOperation->Completed = 
        ref new AsyncOperationWithProgressCompletedHandler<DeploymentResult^, DeploymentProgress>(
        [&](IAsyncOperationWithProgress<DeploymentResult^, DeploymentProgress>^ operation, AsyncStatus)
    {
        SetEvent(opCompletedEvent);
    });

    // Wait until the operation completes
    WaitForSingleObject(opCompletedEvent, INFINITE);

    // Check the status of the operation
    if ( deploymentOperation->Status == AsyncStatus::Error )
    {
        auto deploymentResult = deploymentOperation->GetResults();
        wcout << L"Error code: " << deploymentOperation->ErrorCode.Value << endl;
        wcout << L"Error text: " << deploymentResult->ErrorText->Data() << endl;
        returnValue = 1;
    }
    else if ( deploymentOperation->Status == AsyncStatus::Canceled )
    {
        wcout << L"Installation canceled" << endl;
    }
    else if ( deploymentOperation->Status == AsyncStatus::Completed )
    {
        wcout << L"Installation succeeded" << endl;
    }
    else
    {
        wcout << L"Installation status unknown" << endl;
        returnValue = 1;
    }
    return returnValue;
}
See Also

AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume)

Adds a package (the main package) and its dependency packages to the specified volume for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
Public Function AddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The Uri of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The Uris of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration. ForceApplicationShutdown and None are the only valid options for this method. Specifying any other option results in an E_INVALIDARG return value.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume to which the package is added.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageManagement
See Also

AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable)

Adds a package and its dependency packages to the specified volume for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> externalPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> externalPackageUris)
Public Function AddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>, externalPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The Uri of the source package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The Uris of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration. ForceApplicationShutdown and None are the only valid options for this method. Specifying any other option results in an E_INVALIDARG return value.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume that the package is added to.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

The package family names from the main bundle to be registered.

externalPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of the other packages in the main bundle to be registered.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
See Also

AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable) AddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable)

Adds a package (the main package) and its dependency packages for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions options, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> packageUrisToInstall, IIterable<Uri> relatedPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions options, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> packageUrisToInstall, IEnumerable<Uri> relatedPackageUris)
Public Function AddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, options As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>, packageUrisToInstall As IEnumerable<Uri>, relatedPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The URI of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of framework dependencies to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

options
DeploymentOptions DeploymentOptions DeploymentOptions

The deployment options for the package.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume to which the package is added.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

The package family names from the main bundle to be registered.

packageUrisToInstall
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of optional packages to be installed with the main app package.

relatedPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

URIs of related optional packages to be updated to the same version as the new optional packages.

Returns
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

AddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume) AddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume) AddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume)

Allows single or multiple app packages to be installed with an .appinstaller file.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageByAppInstallerFileAsync(Uri appInstallerFileUri, AddPackageByAppInstallerOptions options, PackageVolume targetVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> AddPackageByAppInstallerFileAsync(Uri appInstallerFileUri, AddPackageByAppInstallerOptions options, PackageVolume targetVolume)
Public Function AddPackageByAppInstallerFileAsync(appInstallerFileUri As Uri, options As AddPackageByAppInstallerOptions, targetVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
appInstallerFileUri
Uri Uri Uri

A Uri to the .appinstaller file.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume that the package is installed to.

Returns
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

AddPackageVolumeAsync(String) AddPackageVolumeAsync(String) AddPackageVolumeAsync(String)

Creates a new volume. The caller must be a member of the administrators group.

public : IAsyncOperation<PackageVolume> AddPackageVolumeAsync(Platform::String packageStorePath)
public IAsyncOperation<PackageVolume> AddPackageVolumeAsync(String packageStorePath)
Public Function AddPackageVolumeAsync(packageStorePath As String) As IAsyncOperation( Of PackageVolume )
Parameters
packageStorePath
Platform::String String String

The absolute path of the package store.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperation interface and returns the newly added PackageVolume.

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

CleanupPackageForUserAsync(String, String) CleanupPackageForUserAsync(String, String) CleanupPackageForUserAsync(String, String)

Cleans up a specified package for a specified user. Used to cleanup packages installed for a user after their user profile is deleted.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> CleanupPackageForUserAsync(Platform::String packageName, Platform::String userSecurityId)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> CleanupPackageForUserAsync(String packageName, String userSecurityId)
Public Function CleanupPackageForUserAsync(packageName As String, userSecurityId As String) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageName
Platform::String String String

The package name.

userSecurityId
Platform::String String String

The user security identifier (SID).

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

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

Remarks

The app binaries are not cleaned up unless the app is installed for has no other users. This method does not clear the registration of the app from the user's profile. Before you call this method, be sure that the user's profile is deleted. If the user profile is not deleted and the user logs back to the profile, the profile may show traces of the app. There may also be broken file type associations and broken tile links for the app. The caller must have administrative privilege or the call fails. In addition, the policy to allow deployment operations in special profiles must be enabled. By default, this policy is disabled.

See Also

ClearPackageStatus(String, PackageStatus) ClearPackageStatus(String, PackageStatus) ClearPackageStatus(String, PackageStatus)

Clears the status of a package.

public : void ClearPackageStatus(Platform::String packageFullName, PackageStatus status)
public void ClearPackageStatus(String packageFullName, PackageStatus status)
Public Function ClearPackageStatus(packageFullName As String, status As PackageStatus) As void
Parameters
packageFullName
Platform::String String String

The full name of the package.

status
PackageStatus PackageStatus PackageStatus

One of the enumeration values that specifies the status to clear.

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

FindPackage(String) FindPackage(String) FindPackage(String)

Retrieves information about the specified package installed for any user.

public : Package FindPackage(Platform::String packageFullName)
public Package FindPackage(String packageFullName)
Public Function FindPackage(packageFullName As String) As Package
Parameters
packageFullName
Platform::String String String

The full name of the package. This parameter cannot be null.

Returns

If this method succeeds it returns a package object that contains information about the specified package, including but not limited to its name, publisher, version, and install location. If the specified package is not found, this method returns null.

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

Remarks

This method requires administrative privileges. The returned package may be installed for the current user or for another user.

FindPackageForUser(String, String) FindPackageForUser(String, String) FindPackageForUser(String, String)

Retrieves information about a specific package installed for a specific user or for all users.

public : Package FindPackageForUser(Platform::String userSecurityId, Platform::String packageFullName)
public Package FindPackageForUser(String userSecurityId, String packageFullName)
Public Function FindPackageForUser(userSecurityId As String, packageFullName As String) As Package
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is string.Empty, the packages are retrieved for the current user.

packageFullName
Platform::String String String

The full name of the package.

Returns

The package.

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

Remarks

This method requires administrative privileges if the user security ID specified is different from the user security ID of the calling user. Otherwise, an AccessDeniedException is thrown.

FindPackages() FindPackages() FindPackages()

Retrieves information about a specified family of packages installed across all users.

public : IIterable<Package> FindPackages()
public IEnumerable<Package> FindPackages()
Public Function FindPackages() As IEnumerable<Package>( Of Package )
Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location.

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

Examples

This example uses FindPackages() to enumerate the installed packages for all users.

using Windows.Management.Deployment;

public static int Main(string[] args)
{
    PackageManager packageManager = new PackageManager();

    IEnumerable<Windows.ApplicationModel.Package> packages = 
        (IEnumerable<Windows.ApplicationModel.Package>) packageManager.FindPackages();

    int packageCount = 0;
    foreach (var package in packages)
    {
        DisplayPackageInfo(package);

        packageCount += 1;
    }

    if (packageCount < 1)
    {
        Console.WriteLine("No packages were found.");
    }
}

private static void DisplayPackageInfo(Windows.ApplicationModel.Package package)
{
    Console.WriteLine("Name: {0}", package.Id.Name);

    Console.WriteLine("FullName: {0}", package.Id.FullName);

    Console.WriteLine("Version: {0}.{1}.{2}.{3}", package.Id.Version.Major, package.Id.Version.Minor,
        package.Id.Version.Build, package.Id.Version.Revision);

    Console.WriteLine("Publisher: {0}", package.Id.Publisher);

    Console.WriteLine("PublisherId: {0}", package.Id.PublisherId);

    Console.WriteLine("Installed Location: {0}", package.InstalledLocation.Path);

    Console.WriteLine("IsFramework: {0}", package.IsFramework);
}
using namespace Windows::Management::Deployment;

[STAThread]
int __cdecl main(Platform::Array<String^>^ args)
{
    PackageManager^ packageManager = ref new PackageManager();

    IIterable<Windows::ApplicationModel::Package^>^ packages = packageManager->FindPackages(); 

    int packageCount = 0;
    std::for_each(Windows::Foundation::Collections::begin(packages), Windows::Foundation::Collections::end(packages), 
    [&](Windows::ApplicationModel::Package^ package) 
    {
        DisplayPackageInfo(package);

        packageCount += 1; 
    });

    if ( packageCount < 1 )
    {
        wcout << L"No packages were found." << endl;
    }

    return 0;
}

void DisplayPackageInfo(Windows::ApplicationModel::Package^ package)
{
    wcout << L"Name: " << package->Id->Name->Data() << endl;
    wcout << L"FullName: " << package->Id->FullName->Data() << endl;
    wcout << L"Version: " << package->Id->Version.Major << "." << 
        package->Id->Version.Minor << "." << package->Id->Version.Build << 
        "." << package->Id->Version.Revision << endl;
    wcout << L"Publisher: " << package->Id->Publisher->Data() << endl;
    wcout << L"PublisherId: " << package->Id->PublisherId->Data() << endl;
    wcout << L"Installed Location: " << package->InstalledLocation->Path->Data() << endl;
    wcout << L"IsFramework: " << (package->IsFramework ? L"True" : L"False") << endl;
}

Remarks

This method requires administrative privileges. Otherwise, an AccessDeniedException is thrown.

See Also

FindPackages(String) FindPackages(String) FindPackages(String)

Retrieves information about a specified family of packages installed across all users.

public : IIterable<Package> FindPackages(Platform::String packageFamilyName)
public IEnumerable<Package> FindPackages(String packageFamilyName)
Public Function FindPackages(packageFamilyName As String) As IEnumerable<Package>( Of Package )
Parameters
packageFamilyName
Platform::String String String

The package family name. This parameter cannot be null.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects with the same package family name will be returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified package family name are found, this method returns an empty list.

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

Remarks

This method requires administrative privileges. Each package in the IIterable(Package) collection may be installed for the current user or for another user. This method differs from FindPackages(String packageName, String pulisherName) method. Here the packageFamilyName parameter is a single string, comprised of the package name and package publisher hash.

See Also

FindPackages(String, String) FindPackages(String, String) FindPackages(String, String)

Finds all installed packages with the specified name and publisher.

public : IIterable<Package> FindPackages(Platform::String packageName, Platform::String packagePublisher)
public IEnumerable<Package> FindPackages(String packageName, String packagePublisher)
Public Function FindPackages(packageName As String, packagePublisher As String) As IEnumerable<Package>( Of Package )
Parameters
packageName
Platform::String String String

The package name. This parameter cannot be null.

packagePublisher
Platform::String String String

The package publisher. This parameter cannot be null.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects with the same package name and publisher name is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified name and publisher are found, this method returns an empty list.

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

Remarks

This method requires administrative privileges.

See Also

FindPackagesForUser(String) FindPackagesForUser(String) FindPackagesForUser(String)

Finds all packages installed for the specified user.

public : IIterable<Package> FindPackagesForUser(Platform::String userSecurityId)
public IEnumerable<Package> FindPackagesForUser(String userSecurityId)
Public Function FindPackagesForUser(userSecurityId As String) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is string.Empty, the packages are retrieved for the current user.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location.

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

Remarks

This method and its overloads require administrative privileges if the user security ID specified is different from the user security ID of the calling user. Otherwise, an AccessDeniedException is thrown. Similar to the FindPackages method, this method and its overloads can be used to enumerate the installed packages for a particular user.

See Also

FindPackagesForUser(String, String) FindPackagesForUser(String, String) FindPackagesForUser(String, String)

Retrieves information about a specified family of packages installed for a specific user.

public : IIterable<Package> FindPackagesForUser(Platform::String userSecurityId, Platform::String packageFamilyName)
public IEnumerable<Package> FindPackagesForUser(String userSecurityId, String packageFamilyName)
Public Function FindPackagesForUser(userSecurityId As String, packageFamilyName As String) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user.

packageFamilyName
Platform::String String String

The family name of packages to find. This parameter cannot be null.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified package family name are found, this method returns an empty list.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesForUser(String, String, String) FindPackagesForUser(String, String, String) FindPackagesForUser(String, String, String)

Retrieves information about all packages with the specified package name and publisher name, installed for a specific user.

public : IIterable<Package> FindPackagesForUser(Platform::String userSecurityId, Platform::String packageName, Platform::String packagePublisher)
public IEnumerable<Package> FindPackagesForUser(String userSecurityId, String packageName, String packagePublisher)
Public Function FindPackagesForUser(userSecurityId As String, packageName As String, packagePublisher As String) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user.

packageName
Platform::String String String

The package name. This parameter cannot be null.

packagePublisher
Platform::String String String

The package publisher. This parameter cannot be null.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified name and publisher are found, this method returns an empty list.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesForUserWithPackageTypes(String, String, String, PackageTypes) FindPackagesForUserWithPackageTypes(String, String, String, PackageTypes) FindPackagesForUserWithPackageTypes(String, String, String, PackageTypes)

Retrieves information about packages of specific types with the specified package name and publisher name, installed for a specific user.

public : IIterable<Package> FindPackagesForUserWithPackageTypes(Platform::String userSecurityId, Platform::String packageName, Platform::String packagePublisher, PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesForUserWithPackageTypes(String userSecurityId, String packageName, String packagePublisher, PackageTypes packageTypes)
Public Function FindPackagesForUserWithPackageTypes(userSecurityId As String, packageName As String, packagePublisher As String, packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user. Any user SID other than that of current user requires administrative privileges.

packageName
Platform::String String String

The package name. This parameter can't be null.

packagePublisher
Platform::String String String

The package publisher. This parameter can't be null.

packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified package publisher and family name are found, this method returns an empty list. The packageTypes parameter determines the types of packages to return.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesForUserWithPackageTypes(String, String, PackageTypes) FindPackagesForUserWithPackageTypes(String, String, PackageTypes) FindPackagesForUserWithPackageTypes(String, String, PackageTypes)

Retrieves information about a specified family of packages and of specific types that are installed for the specified user.

public : IIterable<Package> FindPackagesForUserWithPackageTypes(Platform::String userSecurityId, Platform::String packageFamilyName, PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesForUserWithPackageTypes(String userSecurityId, String packageFamilyName, PackageTypes packageTypes)
Public Function FindPackagesForUserWithPackageTypes(userSecurityId As String, packageFamilyName As String, packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user. Any user SID other than that of current user requires administrative privileges.

packageFamilyName
Platform::String String String

The family name of packages to find. This parameter can't be null.

packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified package family name are found, this method returns an empty list. The packageTypes parameter determines the types of packages to return.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesForUserWithPackageTypes(String, PackageTypes) FindPackagesForUserWithPackageTypes(String, PackageTypes) FindPackagesForUserWithPackageTypes(String, PackageTypes)

Finds packages of specific types that are installed for the specified user.

public : IIterable<Package> FindPackagesForUserWithPackageTypes(Platform::String userSecurityId, PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesForUserWithPackageTypes(String userSecurityId, PackageTypes packageTypes)
Public Function FindPackagesForUserWithPackageTypes(userSecurityId As String, packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
userSecurityId
Platform::String String String

The user security identifier (SID). If this parameter is null, the packages are retrieved for the current user. Any user SID other than that of current user requires administrative privileges.

packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. The packageTypes parameter determines the types of packages to return.

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

Remarks

This method and its overloads require administrative privileges if the user SID specified is different from the user SID of the calling user. Otherwise, an AccessDeniedException is thrown.

See Also

FindPackagesWithPackageTypes(String, String, PackageTypes) FindPackagesWithPackageTypes(String, String, PackageTypes) FindPackagesWithPackageTypes(String, String, PackageTypes)

Finds all installed packages of specific types with the specified name and publisher.

public : IIterable<Package> FindPackagesWithPackageTypes(Platform::String packageName, Platform::String packagePublisher, PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesWithPackageTypes(String packageName, String packagePublisher, PackageTypes packageTypes)
Public Function FindPackagesWithPackageTypes(packageName As String, packagePublisher As String, packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
packageName
Platform::String String String

The package name. This parameter can't be null.

packagePublisher
Platform::String String String

The package publisher. This parameter can't be null.

packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects with the same package name and publisher name is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified name and publisher are found, this method returns an empty list. The packageTypes parameter determines the types of packages to return.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesWithPackageTypes(String, PackageTypes) FindPackagesWithPackageTypes(String, PackageTypes) FindPackagesWithPackageTypes(String, PackageTypes)

Retrieves information about a specified family of packages and specific package types that are installed across all users.

public : IIterable<Package> FindPackagesWithPackageTypes(Platform::String packageFamilyName, PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesWithPackageTypes(String packageFamilyName, PackageTypes packageTypes)
Public Function FindPackagesWithPackageTypes(packageFamilyName As String, packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
packageFamilyName
Platform::String String String

The package family name. This parameter can't be null.

packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects with the same package family name is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified package family name are found, this method returns an empty list. The packageTypes parameter determines the types of packages to return.

Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
packageQuery
See Also

FindPackagesWithPackageTypes(PackageTypes) FindPackagesWithPackageTypes(PackageTypes) FindPackagesWithPackageTypes(PackageTypes)

Retrieves information about specific package types that are installed across all users.

public : IIterable<Package> FindPackagesWithPackageTypes(PackageTypes packageTypes)
public IEnumerable<Package> FindPackagesWithPackageTypes(PackageTypes packageTypes)
Public Function FindPackagesWithPackageTypes(packageTypes As PackageTypes) As IEnumerable<Package>( Of Package )
Parameters
packageTypes
PackageTypes PackageTypes PackageTypes

A combination of PackageTypes -typed values that are combined by using a bitwise OR operation. The resulting value specifies the types of packages to be included in the result set.

Returns
IIterable<Package> IEnumerable<Package> IEnumerable<Package>

If the method succeeds, an enumerable collection of package objects is returned. Each package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. The packageTypes parameter determines the types of packages to return.

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

Remarks

This method and its overloads require administrative privileges.

See Also

FindPackageVolume(String) FindPackageVolume(String) FindPackageVolume(String)

Gets the specified volume.

public : PackageVolume FindPackageVolume(Platform::String volumeName)
public PackageVolume FindPackageVolume(String volumeName)
Public Function FindPackageVolume(volumeName As String) As PackageVolume
Parameters
volumeName
Platform::String String String

The volume media ID, which is a GUID value.

Returns

The requested volume.

FindPackageVolumes() FindPackageVolumes() FindPackageVolumes()

Gets all the known volumes, regardless of their current state.

public : IIterable<PackageVolume> FindPackageVolumes()
public IEnumerable<PackageVolume> FindPackageVolumes()
Public Function FindPackageVolumes() As IEnumerable<PackageVolume>( Of PackageVolume )
Returns
IIterable<PackageVolume> IEnumerable<PackageVolume> IEnumerable<PackageVolume>

All the known volumes, regardless of their current state.

FindUsers(String) FindUsers(String) FindUsers(String)

Finds the users who have installed the specified package.

public : IIterable<PackageUserInformation> FindUsers(Platform::String packageFullName)
public IEnumerable<PackageUserInformation> FindUsers(String packageFullName)
Public Function FindUsers(packageFullName As String) As IEnumerable<PackageUserInformation>( Of PackageUserInformation )
Parameters
packageFullName
Platform::String String String

The full name of the package. This parameter cannot be null.

Returns
IIterable<PackageUserInformation> IEnumerable<PackageUserInformation> IEnumerable<PackageUserInformation>

If the method succeeds, an enumerable collection of package user information objects is returned. Each PackageUserInformation object in this collection contains the user security identifier (user SID) of a user for whom the specified package is installed. If no packages with the specified package full name are found, this method returns an empty list.

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

Examples

Call the PackageManager.FindUsers method to enumerate the users who have installed a package. This example displays the information in the PackageUserInformation.UserSecurityId property.


using System.Security.Principal;
using Windows.Deployment.PackageManager;

private static void DisplayPackageUsers(
    PackageManager packageManager, 
    Windows.ApplicationModel.Package package)
{
    IEnumerable<PackageUserInformation> packageUsers = packageManager.FindUsers(
        package.Id.FullName);

    Console.Write("Users: ");

    foreach (var packageUser in packageUsers)
    {
        Console.Write("{0} ", SidToAccountName(packageUser.UserSecurityId));
    }

    Console.WriteLine();
}

private static string SidToAccountName(string sidString)
{
    SecurityIdentifier sid = new SecurityIdentifier(sidString);
    try
    {
        NTAccount account = (NTAccount)sid.Translate(typeof(NTAccount));
        return account.ToString();
    }
    catch (IdentityNotMappedException)
    {
        return sidString;
    }
}
using Windows::Management::Deployment;

void DisplayPackageUsers(
    PackageManager^ packageManager, 
    Windows::ApplicationModel::Package^ package)
{
    IIterable<PackageUserInformation^>^ packageUsers = packageManager->FindUsers(
        package->Id->FullName);

    wcout << L"Users: ";

    std::for_each(begin(packageUsers), end(packageUsers), 
        [&](PackageUserInformation^ packageUser)
    {
        wstring stringSid;

        SidToAccountName(packageUser->UserSecurityId->Data(), stringSid);

        wcout << stringSid << L" ";
    });
    wcout << endl;
}

void SidToAccountName(wstring sidString, wstring& stringSid)
{
    PSID sid = NULL;

    if ( ConvertStringSidToSid(sidString.c_str(), &sid) )
    {
        DWORD nameCharCount = 0;
        DWORD domainNameCharCount = 0;
        SID_NAME_USE sidType;

        // determine how much space is required to store the name and domainName
        LookupAccountSid(NULL, sid, NULL, &nameCharCount, NULL, &domainNameCharCount, &sidType);

        wchar_t *name = new wchar_t[nameCharCount + 1]; // leave space for terminating null
        wchar_t *domainName = new wchar_t[domainNameCharCount + 1];

        ZeroMemory(name, (nameCharCount + 1) * sizeof(wchar_t));
        ZeroMemory(domainName, (domainNameCharCount + 1) * sizeof(wchar_t));

        try
        {
            if ( LookupAccountSid(NULL, sid, name, &nameCharCount, domainName, &domainNameCharCount, &sidType) )
            {
                stringSid = domainName;
                stringSid = stringSid + L"\\" + name;
            }
        }
        catch ( ... )
        {
            // do nothing, original SID will be used.
        }

        delete [] domainName;
        delete [] name;
    }

    if ( stringSid.length() == 0 )
        stringSid = sidString;

    if ( sid != NULL )
        LocalFree(sid);
}

Remarks

This method requires administrative privileges.

See Also

GetDefaultPackageVolume() GetDefaultPackageVolume() GetDefaultPackageVolume()

Gets the default package volume, which is the target of deployment operations such as the AddPackageAsync method.

public : PackageVolume GetDefaultPackageVolume()
public PackageVolume GetDefaultPackageVolume()
Public Function GetDefaultPackageVolume() As PackageVolume
Returns

The default package volume, which is the target of deployment operations such as the AddPackageAsync method.

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

GetPackageVolumesAsync() GetPackageVolumesAsync() GetPackageVolumesAsync()

Gets the package volumes on the device.

public : IAsyncOperation<IVectorView<PackageVolume>> GetPackageVolumesAsync()
public IAsyncOperation<IReadOnlyList<PackageVolume>> GetPackageVolumesAsync()
Public Function GetPackageVolumesAsync() As IAsyncOperation<IReadOnlyList<PackageVolume>>( Of IVectorView )
Returns
IAsyncOperation<IVectorView<PackageVolume>> IAsyncOperation<IReadOnlyList<PackageVolume>> IAsyncOperation<IReadOnlyList<PackageVolume>>

Returns an asynchronous operation that completes with the package volumes.

Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

MovePackageToVolumeAsync(String, DeploymentOptions, PackageVolume) MovePackageToVolumeAsync(String, DeploymentOptions, PackageVolume) MovePackageToVolumeAsync(String, DeploymentOptions, PackageVolume)

Moves the specified package to the specified volume using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> MovePackageToVolumeAsync(Platform::String packageFullName, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> MovePackageToVolumeAsync(String packageFullName, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
Public Function MovePackageToVolumeAsync(packageFullName As String, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFullName
Platform::String String String

The full name of the package to move.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

One of the enumeration values that specifies a deployment option.

targetVolume
PackageVolume PackageVolume PackageVolume

The target volume.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

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

Remarks

This method lets the caller move a package from one logical volume to another.

ProvisionPackageForAllUsersAsync(String) ProvisionPackageForAllUsersAsync(String) ProvisionPackageForAllUsersAsync(String)

Enables an app package to be installed for all users on a device.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(Platform::String packageFamilyName)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> ProvisionPackageForAllUsersAsync(String packageFamilyName)
Public Function ProvisionPackageForAllUsersAsync(packageFamilyName As String) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFamilyName
Platform::String String String

The FamilyName of the app package to be installed.

Returns
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

This example demonstrates adding a staged or existing registered package for all users on a device.

using Windows.Foundation;
using Windows.Management.Deployment;


public void provisionForAllUsers(string inputPackageFamilyName)
{

    var packageManager = new PackageManager();

    var result = packageManager.ProvisionPackageForAllUsersAsync(inputPackageFamilyName).AsTask().Result;

    if (result.ExtendedErrorCode != null)

    {

        System.Console.WriteLine("Error {0} provisioning {1}", result, inputPackageFamilyName);

        throw result.ExtendedErrorCode.HResult;

    }

}

Remarks

To provision a package you must be an administrator. The app package to be provisioned must be staged, and it must be on the system volume.

If the package is already provisioned, this perform a "clean" reprovision. A "clean" reprovision will remove all previous installs of this package so the package will behave as if this were its first installation.

Note

If you are provisioning optional packages, you must specify each optional package individually with its own method call.

RegisterPackageAsync(Uri, IIterable, DeploymentOptions) RegisterPackageAsync(Uri, IIterable, DeploymentOptions) RegisterPackageAsync(Uri, IIterable, DeploymentOptions)

Registers a package (the main package) and its dependency packages for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageAsync(Uri manifestUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageAsync(Uri manifestUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
Public Function RegisterPackageAsync(manifestUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
manifestUri
Uri Uri Uri

The Uri of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The Uris of the dependency packages.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration that specify deployment options.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

See Also

RegisterPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) RegisterPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) RegisterPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume)

Registers a package (the main package) and its dependency packages on the specified volume for the current user, using the specified deployment options.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageAsync(Uri manifestUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume appDataVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageAsync(Uri manifestUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume appDataVolume)
Public Function RegisterPackageAsync(manifestUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, appDataVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
manifestUri
Uri Uri Uri

The Uri of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The Uris of the dependency packages.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration that specify deployment options.

appDataVolume
PackageVolume PackageVolume PackageVolume

The volume on which the app stores data for the current user.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

See Also

RegisterPackageByFamilyNameAsync(String, IIterable, DeploymentOptions, PackageVolume, IIterable) RegisterPackageByFamilyNameAsync(String, IIterable, DeploymentOptions, PackageVolume, IIterable) RegisterPackageByFamilyNameAsync(String, IIterable, DeploymentOptions, PackageVolume, IIterable)

Registers a package (the main package) by its family name and its dependency packages for the current user.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageByFamilyNameAsync(Platform::String mainPackageFamilyName, IIterable<Platform::String> dependencyPackageFamilyNames, DeploymentOptions deploymentOptions, PackageVolume appDataVolume, IIterable<Platform::String> optionalPackageFamilyNames)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageByFamilyNameAsync(String mainPackageFamilyName, IEnumerable<String> dependencyPackageFamilyNames, DeploymentOptions deploymentOptions, PackageVolume appDataVolume, IEnumerable<String> optionalPackageFamilyNames)
Public Function RegisterPackageByFamilyNameAsync(mainPackageFamilyName As String, dependencyPackageFamilyNames As IEnumerable<String>, deploymentOptions As DeploymentOptions, appDataVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
mainPackageFamilyName
Platform::String String String

A string that specifies the family name of the main package to be registered.

dependencyPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

Strings that specify the family names of the dependency packages to be registered.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A DeploymentOptions -typed value that specifies the package deployment option.

appDataVolume
PackageVolume PackageVolume PackageVolume

The package volume to store that app data on.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

Strings that specify the optional package family names from the main bundle to be registered.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

RegisterPackageByFullNameAsync(String, IIterable, DeploymentOptions) RegisterPackageByFullNameAsync(String, IIterable, DeploymentOptions) RegisterPackageByFullNameAsync(String, IIterable, DeploymentOptions)

Registers a package (the main package) by its full name and its dependency packages for the current user.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageByFullNameAsync(Platform::String mainPackageFullName, IIterable<Platform::String> dependencyPackageFullNames, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RegisterPackageByFullNameAsync(String mainPackageFullName, IEnumerable<String> dependencyPackageFullNames, DeploymentOptions deploymentOptions)
Public Function RegisterPackageByFullNameAsync(mainPackageFullName As String, dependencyPackageFullNames As IEnumerable<String>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
mainPackageFullName
Platform::String String String

A string that specifies the full name of the main package to be registered.

dependencyPackageFullNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

Strings that specify the full names of the dependency packages to be registered.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A DeploymentOptions -typed value that specifies the package deployment option.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

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

Remarks

To hide specifics about the manifest of a bundle package, instead of calling RegisterPackageAsync, you can call RegisterPackageByFullNameAsync to register a package by its full name. Bundle packages and regular packages are both referenced by the common package full name and thus registration by full name reduces the amount of domain knowledge required by the caller.

RegisterPackageByFullNameAsync can't install a package for any user other than the caller. The dependencyPackageFullNames can contain 0 elements if there aren't any dependency packages.

RemovePackageAsync(String) RemovePackageAsync(String) RemovePackageAsync(String)

Removes a package for the current user asynchronously and receives progress and status messages on the removal operation. Dependency packages are also removed for the user if no other packages installed for the user depend on them.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageAsync(Platform::String packageFullName)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageAsync(String packageFullName)
Public Function RemovePackageAsync(packageFullName As String) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFullName
Platform::String String String

A string representation of the package identity to identify the package to be removed.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

Examples

Call the RemovePackageAsync(String) method to uninstall the app package. Notice that the package full name in packageFullName comes from a command-line argument.

RemovePackageAsync(String) returns an object that can be used to manage the asynchronous operation. Use the Completed property to set the delegate. Check the Status property to determine the status of the deployment operation. If the status is Error, the example calls the GetResults method to get additional error information.


using Windows.Foundation;
using Windows.Management.Deployment;

[STAThread]
public static int Main(string[] args)
{
    string inputPackageFullName = args[0];
    int returnValue = 0;

    PackageManager packageManager = new Windows.Management.Deployment.PackageManager();

    IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> deploymentOperation = 
        packageManager.RemovePackageAsync(inputPackageFullName);
    // This event is signaled when the operation completes
    ManualResetEvent opCompletedEvent = new ManualResetEvent(false); 

    // Define the delegate using a statement lambda
    deploymentOperation.Completed = (depProgress, status) => { opCompletedEvent.Set(); };

    // Wait until the operation completes
    opCompletedEvent.WaitOne();

    // Check the status of the operation
    if (deploymentOperation.Status == AsyncStatus.Error)
    {
        DeploymentResult deploymentResult = deploymentOperation.GetResults();
        Console.WriteLine("Error code: {0}", deploymentOperation.ErrorCode);
        Console.WriteLine("Error text: {0}", deploymentResult.ErrorText);
        returnValue = 1;
    }
    else if (deploymentOperation.Status == AsyncStatus.Canceled)
    {
        Console.WriteLine("Removal canceled");
    }
    else if (deploymentOperation.Status == AsyncStatus.Completed)
    {
        Console.WriteLine("Removal succeeded");
    }
    else
    {
        returnValue = 1;
        Console.WriteLine("Removal status unknown");
    }

    return returnValue;
}
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Management::Deployment;

int __cdecl main(Platform::Array<String^>^ args)
{
    String^ inputPackageFullName = args[1];
    int returnValue = 0;

    PackageManager^ packageManager = ref new PackageManager();

    auto deploymentOperation = packageManager->RemovePackageAsync(inputPackageFullName);

    DeploymentResult^ deploymentOperationResult;

    // This event is signaled when the operation completes
    opCompletedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

    // Define the delegate
    deploymentOperation->Completed = 
        ref new AsyncOperationWithProgressCompletedHandler<DeploymentResult^, DeploymentProgress>(
        [&](IAsyncOperationWithProgress<DeploymentResult^, DeploymentProgress>^ operation, AsyncStatus)
    {
        SetEvent(opCompletedEvent);
    });

    // Wait until the operation completes
    WaitForSingleObject(opCompletedEvent, INFINITE);

    // Check the status of the operation
    if ( deploymentOperation->Status == AsyncStatus::Error )
    {
        auto deploymentResult = deploymentOperation->GetResults();
        wcout << L"Removal Error: " << deploymentOperation->ErrorCode.Value << endl;
        wcout << L"Detailed Error Text: " << deploymentResult->ErrorText->Data() << endl;
        returnValue = 1;
    }
    else if ( deploymentOperation->Status == AsyncStatus::Canceled )
    {
        wcout << L"Removal Canceled" << endl;
    }
    else if ( deploymentOperation->Status == AsyncStatus::Completed )
    {
        wcout << L"Removal succeeded!" << endl;
    }
    else
    {
        wcout << L"Removal status unknown" << endl;
        returnValue = 1;
    }

    return returnValue;
}

Remarks

This request cannot be canceled. The package full name is an alternate form of the package identity that is shorter and is suitable for naming objects such as files and directories. A package identity is represented by the Identity element of the package manifest. When a package is removed it is removed for the current user, which means that the package payload continues to exist if other users have installed the package, but it will not be accessible to the current user. If no other users have the specified package installed, its payload will be removed from the %ProgramFiles%\WindowsApps directory. Any app associated with the package that is being removed will be shutdown automatically as part of the package removal.

See Also

RemovePackageAsync(String, RemovalOptions) RemovePackageAsync(String, RemovalOptions) RemovePackageAsync(String, RemovalOptions)

Removes a package for the current user asynchronously and receives progress and status messages on the removal operation. Dependency packages are also removed for the user if no other packages installed for the user depend on them.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageAsync(Platform::String packageFullName, RemovalOptions removalOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageAsync(String packageFullName, RemovalOptions removalOptions)
Public Function RemovePackageAsync(packageFullName As String, removalOptions As RemovalOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFullName
Platform::String String String

A string representation of the package identity to identify the package to be removed.

removalOptions
RemovalOptions RemovalOptions RemovalOptions

A RemovalOptions -typed value that modifies the removal operation.

Returns
See Also

RemovePackageVolumeAsync(PackageVolume) RemovePackageVolumeAsync(PackageVolume) RemovePackageVolumeAsync(PackageVolume)

Removes the specified volume.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageVolumeAsync(PackageVolume volume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RemovePackageVolumeAsync(PackageVolume volume)
Public Function RemovePackageVolumeAsync(volume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
volume
PackageVolume PackageVolume PackageVolume

The volume to remove.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

RequestAddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) RequestAddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) RequestAddPackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable)

Requests a SmartScreen check and user verification before installing the app package(s).

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> relatedPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> relatedPackageUris)
Public Function RequestAddPackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>, relatedPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The URI of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of the dependency packages to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A valid enumeration values from the DeploymentOptions enumeration.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume that the package is installed to.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

Strings that specify the optional package family names from the main bundle to be staged and registered.

relatedPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of additional packages in the main bundle that should be staged and registered.

Returns
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Examples

The example demonstrates how to use RequestAddPackageAsync in a UWP app by hooking it up to a button click handler. This will invoke the SmartScreen request UI window.

public async void OnInstallNowClicked(object sender, RoutedEventArgs args)
{

    var packageManager = new PackageManager();

    DeploymentOperation result = await packageManager.RequestAddPackageAsync(

            this.currentPackageUri,

            null /*no dependencies*/,

            DeploymentOptions.None,

            null /*stage to default package volume*/,

            null /*no optional packages*/,

            null /*no external packages*/);



    if (result.ExtendedErrorCode != null)

    {

        if (result.ExtendedErrorCode.HResult == 0x80073d01)

        {

            // SmartScreen blocked the app installation.

        }

        else

        {

            // The app installation failed for another reason.

        }

    }

}

RequestAddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume) RequestAddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume) RequestAddPackageByAppInstallerFileAsync(Uri, AddPackageByAppInstallerOptions, PackageVolume)

Allows single or multiple app packages to be installed with an .appinstaller file. This will perform a SmartScreen filter and user verification before installing the app package(s).

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageByAppInstallerFileAsync(Uri appInstallerFileUri, AddPackageByAppInstallerOptions options, PackageVolume targetVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> RequestAddPackageByAppInstallerFileAsync(Uri appInstallerFileUri, AddPackageByAppInstallerOptions options, PackageVolume targetVolume)
Public Function RequestAddPackageByAppInstallerFileAsync(appInstallerFileUri As Uri, options As AddPackageByAppInstallerOptions, targetVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
appInstallerFileUri
Uri Uri Uri

A Uri to the .appinstaller file.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume that the package is installed to.

Returns
Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

Remarks

This method is identical to AddPackageByAppInstallerAsync except this uses the SmartScreen filter.

SetDefaultPackageVolume(PackageVolume) SetDefaultPackageVolume(PackageVolume) SetDefaultPackageVolume(PackageVolume)

Sets the default package volume, which is the target of deployment operations such as the AddPackageAsync method.

public : void SetDefaultPackageVolume(PackageVolume volume)
public void SetDefaultPackageVolume(PackageVolume volume)
Public Function SetDefaultPackageVolume(volume As PackageVolume) As void
Parameters
volume
PackageVolume PackageVolume PackageVolume

The default package volume, which is the target of deployment operations such as the AddPackageAsync method.

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

SetPackageState(String, PackageState) SetPackageState(String, PackageState) SetPackageState(String, PackageState)

Sets the state of a package, for example, to usable, tampered with, and so on.

public : void SetPackageState(Platform::String packageFullName, PackageState packageState)
public void SetPackageState(String packageFullName, PackageState packageState)
Public Function SetPackageState(packageFullName As String, packageState As PackageState) As void
Parameters
packageFullName
Platform::String String String

The full name of the package.

packageState
PackageState PackageState PackageState

One of the enumeration values.

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

Remarks

When SetPackageState is used with a PackageState of Tampered, all processes that are part of the package are terminated. If the package is a framework package, all processes for all packages that depend on the framework are also terminated. This method requires administrative privileges

and alters the status for all users.

SetPackageStatus(String, PackageStatus) SetPackageStatus(String, PackageStatus) SetPackageStatus(String, PackageStatus)

Sets the status of the specified package.

public : void SetPackageStatus(Platform::String packageFullName, PackageStatus status)
public void SetPackageStatus(String packageFullName, PackageStatus status)
Public Function SetPackageStatus(packageFullName As String, status As PackageStatus) As void
Parameters
packageFullName
Platform::String String String

The full name of the package.

status
PackageStatus PackageStatus PackageStatus

One of the enumeration values that describes the status of the package.

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

SetPackageVolumeOfflineAsync(PackageVolume) SetPackageVolumeOfflineAsync(PackageVolume) SetPackageVolumeOfflineAsync(PackageVolume)

Sets the specified volume to an offline state. The caller must be a member of the administrators group.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> SetPackageVolumeOfflineAsync(PackageVolume packageVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> SetPackageVolumeOfflineAsync(PackageVolume packageVolume)
Public Function SetPackageVolumeOfflineAsync(packageVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageVolume
PackageVolume PackageVolume PackageVolume

The volume to take offline.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

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

SetPackageVolumeOnlineAsync(PackageVolume) SetPackageVolumeOnlineAsync(PackageVolume) SetPackageVolumeOnlineAsync(PackageVolume)

Sets the specified volume to an online state. The caller must be a member of the administrators group.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> SetPackageVolumeOnlineAsync(PackageVolume packageVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> SetPackageVolumeOnlineAsync(PackageVolume packageVolume)
Public Function SetPackageVolumeOnlineAsync(packageVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageVolume
PackageVolume PackageVolume PackageVolume

The volume to bring online.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

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

StagePackageAsync(Uri, IIterable) StagePackageAsync(Uri, IIterable) StagePackageAsync(Uri, IIterable)

Stages a package to the system without registering it.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris)
Public Function StagePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of the dependency packages. If there are no dependency packages or dependency packages are already staged, this parameter can be null.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

Remarks

The stage operation will extract the package payload to disk under %ProgramFiles%\WindowsApps.

See Also

StagePackageAsync(Uri, IIterable, DeploymentOptions) StagePackageAsync(Uri, IIterable, DeploymentOptions) StagePackageAsync(Uri, IIterable, DeploymentOptions)

Stages a package to the system without registering it.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
Public Function StagePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of the dependency packages. If there are no dependency packages or dependency packages are already staged, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A combination of DeploymentOptions -typed values that are combined by using a bitwise OR operation. The resulting value specifies the package deployment options.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

See Also

StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume)

Stages a package to the system without registering it.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume)
Public Function StagePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of the dependency packages. If there are no dependency packages or dependency packages are already staged, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration. The resulting value specifies the package deployment options.

targetVolume
PackageVolume PackageVolume PackageVolume

The target volume on which to stage the package.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

See Also

StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable)

Stages a package to the system without registering it.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> externalPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> externalPackageUris)
Public Function StagePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>, externalPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of the dependency packages. If there are no dependency packages or dependency packages are already staged, this parameter can be null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration. The resulting value specifies the package deployment options.

targetVolume
PackageVolume PackageVolume PackageVolume

The target volume on which to stage the package.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

Strings that specify the optional package family names from the main bundle to be staged.

externalPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of other packages in the main bundle to be staged.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable) StagePackageAsync(Uri, IIterable, DeploymentOptions, PackageVolume, IIterable, IIterable, IIterable)

Stages a package to the system without registering it.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions options, PackageVolume targetVolume, IIterable<Platform::String> optionalPackageFamilyNames, IIterable<Uri> packageUrisToInstall, IIterable<Uri> relatedPackageUris)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StagePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions options, PackageVolume targetVolume, IEnumerable<String> optionalPackageFamilyNames, IEnumerable<Uri> packageUrisToInstall, IEnumerable<Uri> relatedPackageUris)
Public Function StagePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, options As DeploymentOptions, targetVolume As PackageVolume, optionalPackageFamilyNames As IEnumerable<String>, packageUrisToInstall As IEnumerable<Uri>, relatedPackageUris As IEnumerable<Uri>) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of framework dependencies to add. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null.

options
DeploymentOptions DeploymentOptions DeploymentOptions

The deployment options for the package.

targetVolume
PackageVolume PackageVolume PackageVolume

The volume to which the package is added.

optionalPackageFamilyNames
IIterable<Platform::String> IEnumerable<String> IEnumerable<String>

The package family names from the main bundle to be staged.

packageUrisToInstall
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>
relatedPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The URIs of additional packages in the main bundle that should be staged.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

Additional features and requirements
Device family
Windows 10 Fall Creators Update (introduced v10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)

StageUserDataAsync(String) StageUserDataAsync(String) StageUserDataAsync(String)

Stages a package's roaming data to the system without registering the package. Call this method after staging the package but before registering the package for a particular user.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StageUserDataAsync(Platform::String packageFullName)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StageUserDataAsync(String packageFullName)
Public Function StageUserDataAsync(packageFullName As String) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFullName
Platform::String String String

The full name of the package.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

See Also

StageUserDataAsync(String, DeploymentOptions) StageUserDataAsync(String, DeploymentOptions) StageUserDataAsync(String, DeploymentOptions)

Stages a package's roaming data to the system without registering the package. Call this method after staging the package but before registering the package for a particular user.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StageUserDataAsync(Platform::String packageFullName, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> StageUserDataAsync(String packageFullName, DeploymentOptions deploymentOptions)
Public Function StageUserDataAsync(packageFullName As String, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageFullName
Platform::String String String

The full name of the package.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

A bitwise combination of enumeration values from the DeploymentOptions enumeration that specify deployment options.

Returns

An object that the caller can observe to track progress and completion for the call. The object implements the IAsyncOperationWithProgress pattern.

See Also

UpdatePackageAsync(Uri, IIterable, DeploymentOptions) UpdatePackageAsync(Uri, IIterable, DeploymentOptions) UpdatePackageAsync(Uri, IIterable, DeploymentOptions)

Updates an installed package or its dependency packages for the current user.

public : IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> UpdatePackageAsync(Uri packageUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
public IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> UpdatePackageAsync(Uri packageUri, IEnumerable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)
Public Function UpdatePackageAsync(packageUri As Uri, dependencyPackageUris As IEnumerable<Uri>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentResult )( Of DeploymentProgress )
Parameters
packageUri
Uri Uri Uri

The source URI of the main package.

dependencyPackageUris
IIterable<Uri> IEnumerable<Uri> IEnumerable<Uri>

The source URIs of the dependency packages.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

One of the permitted enumeration values. ForceApplicationShutdown and None are the only valid options for this method and specifying any other deployment option results in an E_INVALIDARG return value.

Returns

The status of the deployment request. The DeploymentResult contains the final returned value of the deployment operation, once it is completed. The DeploymentProgress can be used to obtain the percentage of completion over the entire course of the deployment operation.

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

Remarks

An installed package can be updated only if the version of the update package is higher than that of the installed package. If no previous version of the package exists, the operation fails.

See Also