Decrypting Windows Azure Package (CSPKG) in Windows Azure SDK

When you build your Windows Azure Application the final
products is a CSPKG file which is uploaded to Windows Azure portal along with ServiceConfiguration.cscfg.
The CSPKG file actually a ZIP file which consist your whole solution along with
configuration needed to deploy your solution in Windows Azure.

If you look inside the CSPKG file you will see a file with
extension CSSX name as Your_Role_Name_GUID.cssx and this file also is a ZIP
file however this file is initially encrypted by MSBuild process. You can decrypt
this file if you wish to do so by using any of the below described method:

Option
1: Modifying MSBuild properties for "CorePublish" target and CPACK command (Applicable
to Windows Azure SDK 1.3)

  1. Go to C:\Program Files (x86)\MSBuild\Microsoft\Cloud
    Service\1.0\Visual Studio 10.0
  2. Open Microsoft.CloudService.targets in any text Editor
  3. Look for the target names as CorePublish and setup
    NoEncryptPackage property to "True" as below inside the CSPACK Command within
    the target

NoEncryptPackage="true"

Completed "CorePublish" target should look like as below:

<Target

      Name="CorePublish"

      DependsOnTargets="$(CorePublishDependsOn)">

    <Message Text="CorePublish: PackageWebRole = $(PackageWebRole)" />

    <Message Text="Publishing starting..." />

    <Message Text="RolePlugins       is @(RoleProperties->'%(RolePlugins)')" />

    <Message Text="Publishing to '$(OutDir)Publish'" />

    <MakeDir Directories=" $(OutDir)Publish " />

    <Message Text="ServiceDefinitionCopy is @(ServiceDefinitionCopy)" />

    <Message Text="ServiceConfigurationCopy is @(ServiceConfigurationCopy)" />

    <Message Text="Roles is @(Roles)" />

    <CSPack

      ServiceDefinitionFile="@(ServiceDefinitionCopy)"

      Output="$(OutDir)Publish\$(ProjectName).cspkg"

      PackRoles="@(Roles)"

      SiteMapping="@(SiteMapping)"

      RoleProperties="@(RoleProperties)"

      CopyOnly="false"

      NoEncryptPackage="true"

      >

    </CSPack>

    <!-- Copy service configuration to output directory -->

    <Message Text="Copying the service configuration file." />

    <Copy SourceFiles="@(ServiceConfigurationCopy)" DestinationFolder="$(OutDir)Publish" />

    <Message Text="DiagnosticsFilesCreated is @(DiagnosticsFilesCreated)" />

   <Delete Files="@(DiagnosticsFilesCreated)" ContinueOnError="true" />

    <Message Text="Publishing process has completed."/>

  </Target>

 

 

Option
2: Setting Up Environment Variable (Applicable to all Windows Azure SDK)

You can set environment variable _CSPACK_FORCE_NOENCRYPT_ to "true"
which will force the build system to generate an unencrypted package. This method
applies for Windows Azure SDK 1.2 and 1.3.