Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. var publishSettings = GetPublishSettings(subscriptionId, resourcegroupName, websiteName);
  2. var sourceBaseOptions = new DeploymentBaseOptions();
  3.  
  4. var targetBaseOptions = new DeploymentBaseOptions
  5. {
  6. ComputerName = publishSettings.ComputerName,
  7. UserName = publishSettings.Username,
  8. Password = publishSettings.Password,
  9. AuthenticationType = "basic",
  10. TraceLevel = Verbose
  11. };
  12. targetBaseOptions.Trace += TargetBaseOptions_Trace;
  13. var syncOptions = new DeploymentSyncOptions
  14. {
  15. DoNotDelete = false,
  16. WhatIf = false,
  17. UseChecksum = true
  18. };
  19.  
  20. using (var deploymentObject = DeploymentManager.CreateObject(DeploymentWellKnownProvider.ContentPath, Path.GetFullPath(websitePath), sourceBaseOptions))
  21. {
  22. var summary = deploymentObject.SyncTo(DeploymentWellKnownProvider.ContentPath, publishSettings.SiteName, targetBaseOptions, syncOptions);
  23. if (summary.Errors > 0) throw new Exception("Website Deployment failed");
  24. if (summary.Errors == 0)
  25. {
  26. Console.WriteLine($"{publishSettings.SiteName}: erfolgreich");
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement