PackageManager PackageManager PackageManager Class

Manages the software available to a user.

Important

You can't use this class in a Windows Store app.

Syntax

Declaration

public sealed class PackageManagerpublic sealed class PackageManagerPublic NotInheritable Class PackageManager

Constructors summary

Creates and initializes a new instance of the object.

Properties summary

Prerelease. Get the debugging settings for package deployment.

Methods summary

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

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

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

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

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

Clears the status of a package.

Retrieves information about the specified package installed for any user.

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

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

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

Finds all installed packages with the specified name and publisher.

Finds all packages installed for the specified user.

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

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

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

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

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

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

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

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

Gets the specified volume.

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

Finds the users who have installed the specified package.

Gets the default package volume, which is the target of deployment operations such as the AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) method.

Gets the package volumes on the device.

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

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

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

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

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

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.

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.

Removes the specified volume.

Sets the default package volume, which is the target of deployment operations such as the AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) method.

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

Sets the status of the specified package.

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

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

Stages a package to the system without registering it.

Stages a package to the system without registering it.

Stages a package to the system without registering it.

Stages a package to the system without registering it.

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.

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.

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

Constructors

  • PackageManager()
    PackageManager()
    PackageManager()
    PackageManager()

    Creates and initializes a new instance of the object.

    public PackageManager()public PackageManager()Public Function PackageManager() As

Properties

  • DebugSettings
    DebugSettings
    DebugSettings
    DebugSettings

    Prerelease. Get the debugging settings for package deployment.

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

    Property Value

Methods

  • AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)

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

    public IAsyncOperationWithProgress<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function AddPackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      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

      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

      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.

    Remarks

    Examples

    The following example uses the AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) 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(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) returns an object that can be used to manage the asynchronous operation. The example uses the Completed property to set the AsyncOperationWithProgressCompletedHandler and checks the Status property to determine the status of the deployment operation. If the status is Error, the example calls the IAsyncOperationWithProgress<TResult, TProgress> 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;
    }
    
  • AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.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<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)public IAsyncOperationWithProgress<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)Public Function AddPackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,targetVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      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

      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

      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

      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.

  • AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})

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

    public IAsyncOperationWithProgress<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} externalPackageUris)public IAsyncOperationWithProgress<DeploymentProgress> AddPackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} externalPackageUris)Public Function AddPackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,targetVolume As Windows.Management.Deployment.PackageVolume,optionalPackageFamilyNames As Windows.Foundation.Collections.IIterable{System.String},externalPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      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

      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

      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

      The volume that the package is added to.

    • optionalPackageFamilyNames

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

    • externalPackageUris

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

    Returns

  • AddPackageVolumeAsync(System.String)
    AddPackageVolumeAsync(System.String)
    AddPackageVolumeAsync(System.String)
    AddPackageVolumeAsync(System.String)

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

    public IAsyncOperation<PackageVolume> AddPackageVolumeAsync(System.String packageStorePath)public IAsyncOperation<PackageVolume> AddPackageVolumeAsync(System.String packageStorePath)Public Function AddPackageVolumeAsync(packageStorePath As System.String) As IAsyncOperation( Of PackageVolume )

    Parameters

    • packageStorePath
      System.String
      System.String
      System.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.

  • CleanupPackageForUserAsync(System.String,System.String)
    CleanupPackageForUserAsync(System.String,System.String)
    CleanupPackageForUserAsync(System.String,System.String)
    CleanupPackageForUserAsync(System.String,System.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<DeploymentProgress> CleanupPackageForUserAsync(System.String packageName,System.String userSecurityId)public IAsyncOperationWithProgress<DeploymentProgress> CleanupPackageForUserAsync(System.String packageName,System.String userSecurityId)Public Function CleanupPackageForUserAsync(packageName As System.String,userSecurityId As System.String) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageName
      System.String
      System.String
      System.String

      The package name.

    • userSecurityId
      System.String
      System.String
      System.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.

    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.

  • ClearPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)
    ClearPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)
    ClearPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)
    ClearPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)

    Clears the status of a package.

    public void ClearPackageStatus(System.String packageFullName,Windows.Management.Deployment.PackageStatus status)public void ClearPackageStatus(System.String packageFullName,Windows.Management.Deployment.PackageStatus status)Public Function ClearPackageStatus(packageFullName As System.String,status As Windows.Management.Deployment.PackageStatus) As void

    Parameters

    • packageFullName
      System.String
      System.String
      System.String

      The full name of the package.

    • status

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

  • FindPackage(System.String)
    FindPackage(System.String)
    FindPackage(System.String)
    FindPackage(System.String)

    Retrieves information about the specified package installed for any user.

    public Package FindPackage(System.String packageFullName)public Package FindPackage(System.String packageFullName)Public Function FindPackage(packageFullName As System.String) As Package

    Parameters

    • packageFullName
      System.String
      System.String
      System.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.

    Remarks

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

  • FindPackageForUser(System.String,System.String)
    FindPackageForUser(System.String,System.String)
    FindPackageForUser(System.String,System.String)
    FindPackageForUser(System.String,System.String)

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

    public Package FindPackageForUser(System.String userSecurityId,System.String packageFullName)public Package FindPackageForUser(System.String userSecurityId,System.String packageFullName)Public Function FindPackageForUser(userSecurityId As System.String,packageFullName As System.String) As Package

    Parameters

    • userSecurityId
      System.String
      System.String
      System.String

      This user security ID of the user for whom the specified package is being retrieved. If this parameter is null, the specified package is retrieved for the current user.

    • packageFullName
      System.String
      System.String
      System.String

      The full name of the package.

    Returns

    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()
    FindPackages()

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

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

    Returns

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

    Remarks

    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;
    }
    
  • FindPackages(System.String)
    FindPackages(System.String)
    FindPackages(System.String)
    FindPackages(System.String)

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

    public IIterable<Package> FindPackages(System.String packageFamilyName)public IIterable<Package> FindPackages(System.String packageFamilyName)Public Function FindPackages(packageFamilyName As System.String) As IIterable( Of Package )

    Parameters

    • packageFamilyName
      System.String
      System.String
      System.String

      The package family name. This parameter cannot be null.

    Returns

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

    Remarks

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

  • FindPackages(System.String,System.String)
    FindPackages(System.String,System.String)
    FindPackages(System.String,System.String)
    FindPackages(System.String,System.String)

    Finds all installed packages with the specified name and publisher.

    public IIterable<Package> FindPackages(System.String packageName,System.String packagePublisher)public IIterable<Package> FindPackages(System.String packageName,System.String packagePublisher)Public Function FindPackages(packageName As System.String,packagePublisher As System.String) As IIterable( Of Package )

    Parameters

    • packageName
      System.String
      System.String
      System.String

      The package name. This parameter cannot be null.

    • packagePublisher
      System.String
      System.String
      System.String

      The package publisher. This parameter cannot be null.

    Returns

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

  • FindPackagesForUser(System.String)
    FindPackagesForUser(System.String)
    FindPackagesForUser(System.String)
    FindPackagesForUser(System.String)

    Finds all packages installed for the specified user.

    public IIterable<Package> FindPackagesForUser(System.String userSecurityId)public IIterable<Package> FindPackagesForUser(System.String userSecurityId)Public Function FindPackagesForUser(userSecurityId As System.String) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.String

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

    Returns

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

    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.

  • FindPackagesForUser(System.String,System.String)
    FindPackagesForUser(System.String,System.String)
    FindPackagesForUser(System.String,System.String)
    FindPackagesForUser(System.String,System.String)

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

    public IIterable<Package> FindPackagesForUser(System.String userSecurityId,System.String packageFamilyName)public IIterable<Package> FindPackagesForUser(System.String userSecurityId,System.String packageFamilyName)Public Function FindPackagesForUser(userSecurityId As System.String,packageFamilyName As System.String) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.String

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

    • packageFamilyName
      System.String
      System.String
      System.String

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

    Returns

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

  • FindPackagesForUser(System.String,System.String,System.String)
    FindPackagesForUser(System.String,System.String,System.String)
    FindPackagesForUser(System.String,System.String,System.String)
    FindPackagesForUser(System.String,System.String,System.String)

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

    public IIterable<Package> FindPackagesForUser(System.String userSecurityId,System.String packageName,System.String packagePublisher)public IIterable<Package> FindPackagesForUser(System.String userSecurityId,System.String packageName,System.String packagePublisher)Public Function FindPackagesForUser(userSecurityId As System.String,packageName As System.String,packagePublisher As System.String) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.String

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

    • packageName
      System.String
      System.String
      System.String

      The package name. This parameter cannot be null.

    • packagePublisher
      System.String
      System.String
      System.String

      The package publisher. This parameter cannot be null.

    Returns

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

  • FindPackagesForUserWithPackageTypes(System.String,System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,System.String,Windows.Management.Deployment.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(System.String userSecurityId,System.String packageName,System.String packagePublisher,Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesForUserWithPackageTypes(System.String userSecurityId,System.String packageName,System.String packagePublisher,Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesForUserWithPackageTypes(userSecurityId As System.String,packageName As System.String,packagePublisher As System.String,packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.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
      System.String
      System.String
      System.String

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

    • packagePublisher
      System.String
      System.String
      System.String

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

    • 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

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

  • FindPackagesForUserWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)

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

    public IIterable<Package> FindPackagesForUserWithPackageTypes(System.String userSecurityId,System.String packageFamilyName,Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesForUserWithPackageTypes(System.String userSecurityId,System.String packageFamilyName,Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesForUserWithPackageTypes(userSecurityId As System.String,packageFamilyName As System.String,packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.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
      System.String
      System.String
      System.String

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

    • 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

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

  • FindPackagesForUserWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesForUserWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)

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

    public IIterable<Package> FindPackagesForUserWithPackageTypes(System.String userSecurityId,Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesForUserWithPackageTypes(System.String userSecurityId,Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesForUserWithPackageTypes(userSecurityId As System.String,packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    • userSecurityId
      System.String
      System.String
      System.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

      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

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

    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.

  • FindPackagesWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,System.String,Windows.Management.Deployment.PackageTypes)

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

    public IIterable<Package> FindPackagesWithPackageTypes(System.String packageName,System.String packagePublisher,Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesWithPackageTypes(System.String packageName,System.String packagePublisher,Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesWithPackageTypes(packageName As System.String,packagePublisher As System.String,packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    • packageName
      System.String
      System.String
      System.String

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

    • packagePublisher
      System.String
      System.String
      System.String

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

    • 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

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

  • FindPackagesWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(System.String,Windows.Management.Deployment.PackageTypes)

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

    public IIterable<Package> FindPackagesWithPackageTypes(System.String packageFamilyName,Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesWithPackageTypes(System.String packageFamilyName,Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesWithPackageTypes(packageFamilyName As System.String,packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    • packageFamilyName
      System.String
      System.String
      System.String

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

    • 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

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

  • FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes)
    FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes)

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

    public IIterable<Package> FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes packageTypes)public IIterable<Package> FindPackagesWithPackageTypes(Windows.Management.Deployment.PackageTypes packageTypes)Public Function FindPackagesWithPackageTypes(packageTypes As Windows.Management.Deployment.PackageTypes) As IIterable( Of Package )

    Parameters

    Returns

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

    Remarks

    This method and its overloads require administrative privileges.

  • FindPackageVolume(System.String)
    FindPackageVolume(System.String)
    FindPackageVolume(System.String)
    FindPackageVolume(System.String)

    Gets the specified volume.

    public PackageVolume FindPackageVolume(System.String volumeName)public PackageVolume FindPackageVolume(System.String volumeName)Public Function FindPackageVolume(volumeName As System.String) As PackageVolume

    Parameters

    • volumeName
      System.String
      System.String
      System.String

      The volume media ID, which is a GUID value.

    Returns

  • FindPackageVolumes()
    FindPackageVolumes()
    FindPackageVolumes()
    FindPackageVolumes()

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

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

    Returns

    • All the known volumes, regardless of their current state.

  • FindUsers(System.String)
    FindUsers(System.String)
    FindUsers(System.String)
    FindUsers(System.String)

    Finds the users who have installed the specified package.

    public IIterable<PackageUserInformation> FindUsers(System.String packageFullName)public IIterable<PackageUserInformation> FindUsers(System.String packageFullName)Public Function FindUsers(packageFullName As System.String) As IIterable( Of PackageUserInformation )

    Parameters

    • packageFullName
      System.String
      System.String
      System.String

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

    Returns

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

    Remarks

    This method requires administrative privileges.

    Examples

    Call the FindUsers(System.String) method to enumerate the users who have installed a package. This example displays the information in the 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);
    }
    
  • GetDefaultPackageVolume()
    GetDefaultPackageVolume()
    GetDefaultPackageVolume()
    GetDefaultPackageVolume()

    Gets the default package volume, which is the target of deployment operations such as the AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) method.

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

    Returns

  • GetPackageVolumesAsync()
    GetPackageVolumesAsync()
    GetPackageVolumesAsync()
    GetPackageVolumesAsync()

    Gets the package volumes on the device.

    public IAsyncOperation<PackageVolume>> GetPackageVolumesAsync()public IAsyncOperation<PackageVolume>> GetPackageVolumesAsync()Public Function GetPackageVolumesAsync() As IAsyncOperation( Of PackageVolume )

    Returns

    • Returns an asynchronous operation that completes with the package volumes.

  • MovePackageToVolumeAsync(System.String,Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    MovePackageToVolumeAsync(System.String,Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    MovePackageToVolumeAsync(System.String,Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    MovePackageToVolumeAsync(System.String,Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)

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

    public IAsyncOperationWithProgress<DeploymentProgress> MovePackageToVolumeAsync(System.String packageFullName,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)public IAsyncOperationWithProgress<DeploymentProgress> MovePackageToVolumeAsync(System.String packageFullName,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)Public Function MovePackageToVolumeAsync(packageFullName As System.String,deploymentOptions As Windows.Management.Deployment.DeploymentOptions,targetVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

    Remarks

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

  • RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)

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

    public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageAsync(Windows.Foundation.Uri manifestUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageAsync(Windows.Foundation.Uri manifestUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function RegisterPackageAsync(manifestUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.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<DeploymentProgress> RegisterPackageAsync(Windows.Foundation.Uri manifestUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume appDataVolume)public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageAsync(Windows.Foundation.Uri manifestUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume appDataVolume)Public Function RegisterPackageAsync(manifestUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,appDataVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • RegisterPackageByFamilyNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String})
    RegisterPackageByFamilyNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String})
    RegisterPackageByFamilyNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String})
    RegisterPackageByFamilyNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String})

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

    public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageByFamilyNameAsync(System.String mainPackageFamilyName,Windows.Foundation.Collections.IIterable{System.String} dependencyPackageFamilyNames,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume appDataVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames)public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageByFamilyNameAsync(System.String mainPackageFamilyName,Windows.Foundation.Collections.IIterable{System.String} dependencyPackageFamilyNames,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume appDataVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames)Public Function RegisterPackageByFamilyNameAsync(mainPackageFamilyName As System.String,dependencyPackageFamilyNames As Windows.Foundation.Collections.IIterable{System.String},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,appDataVolume As Windows.Management.Deployment.PackageVolume,optionalPackageFamilyNames As Windows.Foundation.Collections.IIterable{System.String}) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • mainPackageFamilyName
      System.String
      System.String
      System.String

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

    • dependencyPackageFamilyNames

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

    • deploymentOptions

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

    • appDataVolume

      The package volume to store that app data on.

    • optionalPackageFamilyNames

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

    Returns

    • A report of the deployment progress. The object implements the IAsyncOperationWithProgress pattern.

  • RegisterPackageByFullNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageByFullNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageByFullNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions)
    RegisterPackageByFullNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions)

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

    public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageByFullNameAsync(System.String mainPackageFullName,Windows.Foundation.Collections.IIterable{System.String} dependencyPackageFullNames,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> RegisterPackageByFullNameAsync(System.String mainPackageFullName,Windows.Foundation.Collections.IIterable{System.String} dependencyPackageFullNames,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function RegisterPackageByFullNameAsync(mainPackageFullName As System.String,dependencyPackageFullNames As Windows.Foundation.Collections.IIterable{System.String},deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • mainPackageFullName
      System.String
      System.String
      System.String

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

    • dependencyPackageFullNames

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

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

    Remarks

    To hide specifics about the manifest of a bundle package, instead of calling RegisterPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume), you can call RegisterPackageByFullNameAsync(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions) 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(System.String,Windows.Foundation.Collections.IIterable{System.String},Windows.Management.Deployment.DeploymentOptions) 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(System.String)
    RemovePackageAsync(System.String)
    RemovePackageAsync(System.String)
    RemovePackageAsync(System.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<DeploymentProgress> RemovePackageAsync(System.String packageFullName)public IAsyncOperationWithProgress<DeploymentProgress> RemovePackageAsync(System.String packageFullName)Public Function RemovePackageAsync(packageFullName As System.String) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageFullName
      System.String
      System.String
      System.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.

    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.

    Examples

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

    RemovePackageAsync(System.String) returns an object that can be used to manage the asynchronous operation. Use the Completed property to set the AsyncOperationWithProgressCompletedHandler. Check the Status property to determine the status of the deployment operation. If the status is Error, the example calls the IAsyncOperationWithProgress<TResult, TProgress> 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;
    }
    
  • RemovePackageAsync(System.String,Windows.Management.Deployment.RemovalOptions)
    RemovePackageAsync(System.String,Windows.Management.Deployment.RemovalOptions)
    RemovePackageAsync(System.String,Windows.Management.Deployment.RemovalOptions)
    RemovePackageAsync(System.String,Windows.Management.Deployment.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<DeploymentProgress> RemovePackageAsync(System.String packageFullName,Windows.Management.Deployment.RemovalOptions removalOptions)public IAsyncOperationWithProgress<DeploymentProgress> RemovePackageAsync(System.String packageFullName,Windows.Management.Deployment.RemovalOptions removalOptions)Public Function RemovePackageAsync(packageFullName As System.String,removalOptions As Windows.Management.Deployment.RemovalOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

  • RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume)
    RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume)
    RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume)
    RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume)

    Removes the specified volume.

    public IAsyncOperationWithProgress<DeploymentProgress> RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume volume)public IAsyncOperationWithProgress<DeploymentProgress> RemovePackageVolumeAsync(Windows.Management.Deployment.PackageVolume volume)Public Function RemovePackageVolumeAsync(volume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume)
    SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume)
    SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume)
    SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume)

    Sets the default package volume, which is the target of deployment operations such as the AddPackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) method.

    public void SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume volume)public void SetDefaultPackageVolume(Windows.Management.Deployment.PackageVolume volume)Public Function SetDefaultPackageVolume(volume As Windows.Management.Deployment.PackageVolume) As void

    Parameters

  • SetPackageState(System.String,Windows.Management.Deployment.PackageState)
    SetPackageState(System.String,Windows.Management.Deployment.PackageState)
    SetPackageState(System.String,Windows.Management.Deployment.PackageState)
    SetPackageState(System.String,Windows.Management.Deployment.PackageState)

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

    public void SetPackageState(System.String packageFullName,Windows.Management.Deployment.PackageState packageState)public void SetPackageState(System.String packageFullName,Windows.Management.Deployment.PackageState packageState)Public Function SetPackageState(packageFullName As System.String,packageState As Windows.Management.Deployment.PackageState) As void

    Parameters

    Remarks

    When SetPackageState(System.String,Windows.Management.Deployment.PackageState) 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(System.String,Windows.Management.Deployment.PackageStatus)
    SetPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)
    SetPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)
    SetPackageStatus(System.String,Windows.Management.Deployment.PackageStatus)

    Sets the status of the specified package.

    public void SetPackageStatus(System.String packageFullName,Windows.Management.Deployment.PackageStatus status)public void SetPackageStatus(System.String packageFullName,Windows.Management.Deployment.PackageStatus status)Public Function SetPackageStatus(packageFullName As System.String,status As Windows.Management.Deployment.PackageStatus) As void

    Parameters

    • packageFullName
      System.String
      System.String
      System.String

      The full name of the package.

    • status

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

  • SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume)

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

    public IAsyncOperationWithProgress<DeploymentProgress> SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume packageVolume)public IAsyncOperationWithProgress<DeploymentProgress> SetPackageVolumeOfflineAsync(Windows.Management.Deployment.PackageVolume packageVolume)Public Function SetPackageVolumeOfflineAsync(packageVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume)
    SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume)

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

    public IAsyncOperationWithProgress<DeploymentProgress> SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume packageVolume)public IAsyncOperationWithProgress<DeploymentProgress> SetPackageVolumeOnlineAsync(Windows.Management.Deployment.PackageVolume packageVolume)Public Function SetPackageVolumeOnlineAsync(packageVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})

    Stages a package to the system without registering it.

    public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris)public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris)Public Function StagePackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      The source URI of the main package.

    • dependencyPackageUris

      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.

  • StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)

    Stages a package to the system without registering it.

    public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function StagePackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      The source URI of the main package.

    • dependencyPackageUris

      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

      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.

  • StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume)

    Stages a package to the system without registering it.

    public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume)Public Function StagePackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,targetVolume As Windows.Management.Deployment.PackageVolume) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})
    StagePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions,Windows.Management.Deployment.PackageVolume,Windows.Foundation.Collections.IIterable{System.String},Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri})

    Stages a package to the system without registering it.

    public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} externalPackageUris)public IAsyncOperationWithProgress<DeploymentProgress> StagePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions,Windows.Management.Deployment.PackageVolume targetVolume,Windows.Foundation.Collections.IIterable{System.String} optionalPackageFamilyNames,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} externalPackageUris)Public Function StagePackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions,targetVolume As Windows.Management.Deployment.PackageVolume,optionalPackageFamilyNames As Windows.Foundation.Collections.IIterable{System.String},externalPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri}) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      The source URI of the main package.

    • dependencyPackageUris

      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

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

    • targetVolume

      The target volume on which to stage the package.

    • optionalPackageFamilyNames

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

    • externalPackageUris

      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.

  • StageUserDataAsync(System.String)
    StageUserDataAsync(System.String)
    StageUserDataAsync(System.String)
    StageUserDataAsync(System.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<DeploymentProgress> StageUserDataAsync(System.String packageFullName)public IAsyncOperationWithProgress<DeploymentProgress> StageUserDataAsync(System.String packageFullName)Public Function StageUserDataAsync(packageFullName As System.String) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageFullName
      System.String
      System.String
      System.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.

  • StageUserDataAsync(System.String,Windows.Management.Deployment.DeploymentOptions)
    StageUserDataAsync(System.String,Windows.Management.Deployment.DeploymentOptions)
    StageUserDataAsync(System.String,Windows.Management.Deployment.DeploymentOptions)
    StageUserDataAsync(System.String,Windows.Management.Deployment.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<DeploymentProgress> StageUserDataAsync(System.String packageFullName,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> StageUserDataAsync(System.String packageFullName,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function StageUserDataAsync(packageFullName As System.String,deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    Returns

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

  • UpdatePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    UpdatePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    UpdatePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)
    UpdatePackageAsync(Windows.Foundation.Uri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},Windows.Management.Deployment.DeploymentOptions)

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

    public IAsyncOperationWithProgress<DeploymentProgress> UpdatePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)public IAsyncOperationWithProgress<DeploymentProgress> UpdatePackageAsync(Windows.Foundation.Uri packageUri,Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri} dependencyPackageUris,Windows.Management.Deployment.DeploymentOptions deploymentOptions)Public Function UpdatePackageAsync(packageUri As Windows.Foundation.Uri,dependencyPackageUris As Windows.Foundation.Collections.IIterable{Windows.Foundation.Uri},deploymentOptions As Windows.Management.Deployment.DeploymentOptions) As IAsyncOperationWithProgress( Of DeploymentProgress )

    Parameters

    • packageUri

      The source URI of the main package.

    • dependencyPackageUris

      The source URIs of the dependency packages.

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

    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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Management.Deployment.dll