I was investigating an issue in which using CSPACK to create Windows Azure Package (*.cspkg) received error as below:

 

Error  CloudServices050 : Top-level XML element does not conform to schema

               

The reason for this error was just simple.  The problem was caused by passing service configuration file as parameter while CSPACK use service definition file as input parameter. Because CSPACK application searches for Service Definition name space setting so passing service configuration instead of service definition will cause this error.

 

To solve this problem you just need to pass correct service definition with CSPACK application. 

 

Here is an example of Service Configuration:

 

<?xml version="1.0" encoding="utf-8"?>

<ServiceConfiguration serviceName="WebRoleTestServer"

                      xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"

                      osFamily="1"

                      osVersion="*">

 …………

</ServiceConfiguration>

 

Here is an example of Service Definition:

<?xml version="1.0" encoding="utf-8"?>

<ServiceDefinition name="WebRoleTestServer"

xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">

….

</ServiceDefinition>