RemovePackageAsync(String) method
Collapse the table of content
Expand the table of content

PackageManager.RemovePackageAsync(String) | removePackageAsync(String) method

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.


packageManager.removePackageAsync(packageFullName).done( /* Your success and error handlers */ );



Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

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

Return value

Type: IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress>

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.


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.


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;

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

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

    IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> deploymentOperation = 
    // 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

    // 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");
        returnValue = 1;
        Console.WriteLine("Removal status unknown");

    return returnValue;

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Management::Deployment [C++]



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

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported


Windows::Management::Deployment [C++]



See also

RemovePackageAsync(String, RemovalOptions)



© 2017 Microsoft