PackageDeploymentManager.AddPackageAsync(String, AddPackageOptions) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
virtual IAsyncOperationWithProgress<PackageDeploymentResult ^, PackageDeploymentProgress> ^ AddPackageAsync(Platform::String ^ package, AddPackageOptions ^ options) = AddPackageAsync;
IAsyncOperationWithProgress<PackageDeploymentResult, PackageDeploymentProgress> AddPackageAsync(winrt::hstring const& package, AddPackageOptions const& options);
public IAsyncOperationWithProgress<PackageDeploymentResult,PackageDeploymentProgress> AddPackageAsync(string package, AddPackageOptions options);
function addPackageAsync(package, options)
Public Function AddPackageAsync (package As String, options As AddPackageOptions) As IAsyncOperationWithProgress(Of PackageDeploymentResult, PackageDeploymentProgress)
Parameters
- package
-
String
Platform::String
winrt::hstring
The package to add.
- options
- AddPackageOptions
The deployment options for the package.
Returns
The DeploymentProgress percentage of completion over the entire course of the deployment operation.
Examples
A Fabrikam app installing Contoso's Example package from an .msix
file.
void Install()
{
var package = "d:\\contoso\\example.msix";
var packageDeploymentManager = PackageDeploymentManager.GetDefault();
var options = new AddPackageOptions();
var deploymentResult = await packageDeploymentManager.AddPackageAsync(package, options);
if (deplymentResult.Status == PackageDeploymentStatus.CompletedSuccess)
{
Console.WriteLine("OK");
}
else
{
Console.WriteLine("Error:{} ExtendedError:{} {}",
deploymentResult.Error.HResult, deploymentResult.ExtendedError.HResult, deploymentResult.ErrorText);
}
}