Handling Error - Unable to deploy package due to error "The file provided is not a valid service package"

When you deploy your package to Windows Azure Management Portal it is possible you may received the following error:

Error creating deployment for hosted service
'<Service_NAME>'. The file provided is not a valid service package.

Detailed
error code: InvalidOperationException

The
file provided is not a valid service package. Detailed error code:
InvalidOperationException

Dr.
Watson Diagnostic ID: 1eb83f5ac73847d8a2a5f99f1af88524

Subscription
ID: <Sbuscription_GUID>

Time
started: 5/05/2011 2:35:24 AM UTC

Time
completed: 5/05/2011 2:36:00 AM UTC

Duration:
0:00:35.513

 

 

After working a few of such issues i would suggest trying below steps to narrow down the root cause:

1. Take you CSPKG and CSCFG file and upload to Azure Storage. Now try to deploy the package directly from Azure Storage.

   - If deployment is success that you will know that the issue was in between your development machine and Azure Management Portal connectivity 

2. It is possible that you are running a complex build script to build and deploy your package. Just use the base Windows Azure SDK commands as below:

   - cspack {Click here for more info}

   - csrun {Click here for more info}

   - csmanage {Click here for more info}

   This way you can isolate the issue specific to certain stage if there is any.

3. If you have another machine (or Virtual Machine Running VS + Azure SDK), try opening the same project and deploy from there. This step immediately isolate the problem if it is related with SDK environment specific to your machine.

 

Here are a few common reason for this problem, I discovered:

1. Windows Azure SDK Installation was bad due to some reason. This was primary reason in most of the cases. Removing Windows Azure SDK completely and then installing solved the issue in lots of cases. 

2. I also found that a few users have exported (using xcopy) Windows Azure SDK to a machine which is mainly a build server and they don't want to install SDK on that machine. When new SDK is available, they will need to update their build machine by manually copying SDK files from a machine which has Windows Azure SDK installed. During this phase, they miss a few files here and there which cause this problem. 

3. In one case, I found the machine had two different build of same .net version were installed. After cleaning .net stale versions and installing correct .net 3.5 and 4.0 version the problem was resolved

 

If you have had same experience and found something different, please post your details here.