Eksportér (0) Udskriv
Udvid alt
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

Package an Application by Using the CSPack Command-Line Tool

Updated: October 24, 2014

To deploy an application as a cloud service in Windows Azure, you must first package the application in the appropriate format. You can use the CSPack Command-Line Tool to create the package file. Creating application packages by using CSPack is useful for build scenarios in which you are not using the Visual Studio tools or you are not using MSBuild as part of your build environment. CSPack uses the contents of the service definition file and service configuration file to define the contents of the package. You can modify the service definition and service configuration files by using a text editor or by using Visual Studio.

CSPack generates an application package file (.cspkg) that you can upload to Windows Azure by using the Windows Azure Management Portal. By default, the package is named <ServiceDefinitionFileName>.cspkg, but you can specify a different name by using the /out option of CSPack.

In Windows Azure SDK versions 1.7 and greater, CSPack is installed to
C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\<sdk-version>\bin

In Windows Azure SDK version 1.6 and earlier, the installation directory is
C:\Program Files\Windows Azure SDK\<sdk-version>\bin\

To run the application locally in the Microsoft Azure compute emulator, use the /copyonly option of the CSPack Command-Line Tool. The /copyonly option copies the binary files for the application to a directory layout from which they can be run in the compute emulator.

  1. Click Start, point to All Programs, and then click Windows Azure SDK.

  2. Right-click Windows Azure SDK Command Prompt, and then click Run as administrator.

  3. In the Windows Azure SDK Command Prompt window, change the directory to where your application files are located.

  4. Run the CSPack command with the appropriate parameters for your application. The following example creates an application package that contains the information for a web role. The command specifies the service definition file to use, the directory where binary files can be found, and the name of the package file.

    cspack <DirectoryName>\<ServiceDefinition>

    If the application contains both a web role and a worker role, the following command is used:

    cspack <DirectoryName>\<ServiceDefinition>

    Where the variables are defined as follows:


    Variable Value


    The subdirectory under the root project directory that contains the .csdef file of the Windows Azure project.


    The name of the service definition file. By default, this file is named ServiceDefinition.csdef.


    The name for the generated package file. Typically, this is set to the name of the application. If no file name is specified, the application package is created as <ApplicationName>.cspkg.


    The name of the role as defined in the service definition file.


    The location of the binary files for the role.


    The physical directories for each virtual path defined in the Sites section of the service definition.


    The physical directories of the contents for each virtual path defined in the site node of the service definition.


    The name of the binary file for the role.

See Also

© 2015 Microsoft