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:
- Close Visual Studio
- Shut down Windows Azure Compute Emulator
- Go to Control Panel > System and Maintenance > System
- Click on “Advanced Settings” in the pane on the left
- Switch to the “Advanced” tab and click on the “Environment Variables” Button.
The “Environment Variables” dialog appears.
- Check for a System Variable named _CSPACK_FORCE_NOENCRYPT_
If there is no such variable, create it.
- Set the value of the _CSPACK_FORCE_NOENCRYPT_ variable to “true”
- 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:
- Rename your <cloudservice>.cspkg file to <cloudservice>.zip
- Unpack that .zip folder
- Inside the uncompressed folder there is a file named after your web role <WebRole><Guid>.cssx
- Rename the .cssx file to .zip
- Since you performed the steps before, this .zip file is unencrypted now. Unzip it.
- 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.