public Deployment PublishCloudService(
string package,
string configuration,
string slot = null,
string location = null,
string affinityGroup = null,
string storageAccount = null,
string deploymentName = null,
bool launch = false,
bool forceUpgrade = false)
{
string workingDirectory = GetCurrentDirectory();
string cloudConfigFullPath = configuration;
if (!Path.IsPathRooted(configuration))
{
cloudConfigFullPath = Path.Combine(workingDirectory, configuration);
}
CloudServiceProject cloudServiceProject = new CloudServiceProject(cloudConfigFullPath);
// Initialize publish context
PublishContext context = CreatePublishContext(
cloudServiceProject.ServiceName,
slot,
location,
affinityGroup,
storageAccount,
deploymentName,
cloudServiceProject);
context.ConfigPackageSettings(package, workingDirectory);
// Verify storage account exists
if (!context.PackageIsFromStorageAccount)
{
SetupStorageService(context);
}
WriteVerbose(string.Format(Resources.PublishServiceStartMessage, context.ServiceName));
DeploymentGetResponse deployment = DeployPackage(launch, forceUpgrade, context);
return(new Deployment(deployment));
}