Condividi tramite


Web Deploy package Provider

Applies To: Windows 7, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP

package

The package provider compresses Web content and places it into a .zip file called a package.

Example

msdeploy.exe -verb:sync -source:contentPath="Default Web Site" -dest:package=c:\DWS.zip

The package provider is a redirector of input and output for other Web Deploy providers. It enables you to create an archived backup or "snapshot" of the output of any Web Deploy provider. Unlike the archive provider, which creates a directory structure, the package provider creates a single compressed "package" file that contains an archived directory structure. You can also use the package provider to create a snapshot of the output of any provider, or to restore the contents of a package onto a destination computer.

Creating a package

The package provider takes an argument that is a path to a filename on disk (for example, -dest:package=c:\packages\myapp.zip). If the specified directory does not exist, the operation will fail. A .zip extension will not automatically be added to the filename that you specify.

Important

The maximum size of a file that can be placed in a package is 2,147,483,647 bytes (Int.MaxValue), and the maximum number of files that can be placed in a package is 65,536. If the files that you want to include in a package exceed these limits, use the archiveDir provider instead.

Tip

If you edit a package file in Windows that was created with a different operating system, you may receive the following error when you try to synchronize the package: "Child object 'filePath' cannot be added to object 'filePath'. The 'filePath' provider may not support this deployment." If this happens, unzip and rezip the package file by using Windows Explorer, and try the synchronization again.

Parameterizing items in a package

When you create a package, you can specify that values for certain attributes be specified manually when the package is later synchronized. You can declare the parameter by using the -declareParam operation setting. The parameters that you declare will be stored in a Parameters.xml file inside the package. When you synchronize the package later, you can use the -setParam operation setting to specify a value for the parameter or parameters that you declared. For more information about parameterization, see Using declareParam and setParam.

In a package dump operation, the paths of the source files will be displayed. If you specify the -xml operation setting, the file paths and attributes will be returned in XML format.

In a package sync operation, if the destination is a package file that already exists, new files will be added to the existing package. Files that have changed will be updated. Files that have not changed will not be processed. A file called Archive.xml is included in the package when the package is created. The Archive.xml file contains a listing in XML format of the contents of the package.

Warning

To synchronize a directory or file to a package or archive, you must use the contentPath provider.

Note

If you want to use more than one provider to create your package, you can create a custom manifest file and specify it as the source of the operation by using the manifest provider. For more information, see Creating and Synchronizing a Custom Manifest and Web Deploy manifest Provider.

Synchronizing packages that contain manifests

If a package that contains a manifest file is the source of a sync operation, it may be advisable to use auto as the provider for the destination argument. For example, a command such as the following

msdeploy -verb:sync -source:package="C:\MyPackage.zip" -dest:iisApp="Site1/App1"

may fail with an error like

Source (sitemanifest) and destination (iisApp) are not compatible for the given operation.

This occurs because the iisApp provider specified in the destination argument is not expecting a Manifest.xml file in the source. To resolve this issue, use the auto provider instead:

msdeploy -verb:sync -source:package="C:\MyPackage.zip" -dest:auto

Example usages

1) Synchronize the contents of the default Web site to a package file.

msdeploy.exe -verb:sync -source:contentPath="Default Web Site" -dest:package=c:\DWS.zip

2) Return the paths of the files in a package file.

msdeploy.exe -verb:dump -source:package=c:\DWS.zip

3) Return, in XML format, the paths and attributes of the files in a package file.

msdeploy.exe -verb:dump -source:package=c:\DWS.zip -xml

4) Synchronize the output of the appHostConfig provider for the default Web site to a package file.

msdeploy.exe -verb:sync -source:appHostConfig="Default Web Site" -dest:package=c:\DWS.zip

5) Synchronize the contents of a package file to the site lm/wm3svc/2.

msdeploy.exe -verb:sync -source:package=c:\Site1.zip -dest:metaKey=lm/w3svc/2

6) Set the "defaultpage" parameter to the value "MyDefaultWebPage.htm" and synchronize the ParameterPackage.zip file to its destination.

msdeploy -verb:sync -source:package=ParameterPackage.zip -dest:auto -setParam:name=defaultpage,value=MyDefaultWebPage.htm

7) Unpackage the contents of the Package.zip file and put them in the C:\temp folder. Do not delete other files that already exist in the destination folder.

msdeploy.exe -verb:sync -source:package=C:\package.zip -dest:contentpath=C:\temp -enableRule:DoNotDeleteRule

8) Unpackage the contents of the Package.zip file and put them in the C:\temp folder. Remove any files in the destination folder that are not present in the package.

msdeploy.exe -verb:sync -source:package=C:\package.zip -dest:contentpath=C:\temp

See Also

Web Deploy appHostConfig Provider

Web Deploy archiveDir Provider

Web Deploy auto Provider

Web Deploy contentPath Provider

Web Deploy Operation Settings

Using declareParam and setParam