Condividi tramite


Add-AppxPackage

Applies To: Windows 8, Windows Server 2012

Add-AppxPackage

Adds a signed app package (.appx) to a user account.

Syntax

Parameter Set: AddSet
Add-AppxPackage [-Path] <String> [-DependencyPath <String[]> ] [-ForceApplicationShutdown] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: RegisterSet
Add-AppxPackage [-Path] <String> -Register [-DependencyPath <String[]> ] [-DisableDevelopmentMode] [-ForceApplicationShutdown] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: UpdateSet
Add-AppxPackage [-Path] <String> -Update [-DependencyPath <String[]> ] [-ForceApplicationShutdown] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-AppxPackage cmdlet adds a signed app package (.appx) to a user account. Use the DependencyPath parameter to add all other packages that are required for the installation of the app package.

You can use the Register parameter to install from a folder of unpackaged files during development of Windows® Store apps.

To update an already installed package, the new package must have the same package family name.

Parameters

-DependencyPath<String[]>

Specifies the file path of a dependency package that's required for the installation of the app package (.appx). You can specify the paths to more than one dependency package.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DisableDevelopmentMode

Registers an existing app package (.appx) installation that has been disabled, didn't register, or has become corrupted. Use DisableDevelopmentMode to specify that the manifest is from an existing installation and not from a collection of files in development mode. You can also use this parameter to register an application that the Package Manager API has staged. Use the –Register parameter to specify the location of the app package manifest .xml file from the installation location.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ForceApplicationShutdown

Forces all active processes that are associated with the package or its dependencies to shut down.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Path<String>

Specifies the file path of the app package (.appx).

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Register

Registers an application in development mode. You can use development mode to install applications from a folder of unpackaged files. You can use the –Register parameter to test your Windows® Store apps before you deploy them as app packages (.appx). To register an existing app package (.appx) installation, you must specify the –DisableDevelopmentMode parameter along with -Register.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Update

Specifies that the package being added is a dependency package update. A dependency package is removed from the user account when the parent app is removed. If you do not use -Update, the package being added will be flagged as a primary package and will not be removed from the user account if the parent app is removed. To update an already installed package, the new package must have the same package family name.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.String[]
  • System.IO.FileInfo

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

Examples

EXAMPLE 1

This command adds an app package (.appx) and the signing certificate that the package contains.

PS C:\> Add-AppxPackage -Path C:\Users\user1\Desktop\MyApp.appx –DependencyPath C:\Users\user1\Desktop\winjs.appx

EXAMPLE 2

This command gets the full path of the package manifest file of an installed Windows Store app, and then registers that package. You can use –DisableDevelopmentMode to register an application that is staged by the StagePackageAsync API, has been disabled, or has become corrupted during testing.

PS C:\> $manifestpath = (get-appxpackage -Name "*
WinJS*").InstallLocation + "\Appxmanifest.xml" 
Add-AppxPackage -register $manifestpath –DisableDevelopmentMode
PS C:\> Add-AppxPackage -register $manifestpath –DisableDevelopmentMode

Get-AppxPackage

Get-AppxPackageManifest

Remove-AppxPackage

Get-AppxLog

Get-AppxLastError

Package Manager API

How to Add and Remove Apps