Sunday, September 25, 2011

How To: Look inside the Service Package file

If you ever wanted to see what’s inside a published .cspkg file: here is a small guide how to achieve this…

First there is to say that a .cspkg-file is only a ZIP file with extensions changed. But the contents are encrypted. But there is a way to create unencrypted Service Packages:

  1. Close Visual Studio
  2. Shut down Windows Azure Compute Emulator
  3. Go to Control Panel > System and Maintenance > System
  4. Click on “Advanced Settings” in the pane on the left
  5. Switch to the “Advanced” tab and click on the “Environment Variables” Button.
    The “Environment Variables” dialog appears.
  6. Check for a System Variable named _CSPACK_FORCE_NOENCRYPT_
    If there is no such variable, create it.
  7. Set the value of the _CSPACK_FORCE_NOENCRYPT_ variable to “true”
  8. Start Visual Studio again and publish a Cloud Service Project.

Note: When publishing without encryption, Visual Studio warns you with the following message in the output window
CloudServices44 : Forcing creation of unencrypted package...

To sneak inside the package do the following steps:

  1. Rename your <cloudservice>.cspkg file to <cloudservice>.zip
  2. Unpack that .zip folder
  3. Inside the uncompressed folder there is a file named after your web role <WebRole><Guid>.cssx
  4. Rename the .cssx file to .zip
  5. Since you performed the steps before, this .zip file is unencrypted now. Unzip it.
  6. Find the content of your package in the “sitesroot” folder.

Caution: Although either encrypted and unencrypted packages can be deployed to the cloud, it’s highly recommended to only use encrypted packages for security issues.

1 comment:

  1. Thank you.After setting _CSPACK_FORCE_NOENCRYPT_ ,I could unzip CSSX file.