Esempio n. 1
0
        private void CreateOrDeleteAppOffline(bool create = true)
        {
            var sourceOptions      = WebDeployOptionsFactory.GetSourceOptions();
            var destinationOptions = WebDeployOptionsFactory.GetDestinationOptions(_settings);

            destinationOptions.Trace += WebDeployLogger.DestinationOptions_Trace;
            var syncOptions = WebDeployOptionsFactory.GetSyncOptions(_settings);

            if (!create)
            {
                syncOptions.DoNotDelete = false;
            }

            var sourceProvider      = DeploymentWellKnownProvider.ContentPath;
            var destinationProvider = DeploymentWellKnownProvider.ContentPath;

            using (var deploymentObject = DeploymentManager.CreateObject(sourceProvider, _tempAppOfflinePath, sourceOptions))
            {
                if (!create)
                {
                    syncOptions.DeleteDestination = true;
                }

                deploymentObject.SyncTo(destinationProvider, _settings.SiteName + "/app_offline.htm", destinationOptions, syncOptions);
            }
        }
Esempio n. 2
0
        public static void WebDeploy(Configure <WebDeploySettings> settingsConfigurator)
        {
            var settings = settingsConfigurator(new WebDeploySettings());

            // ReSharper disable once UnusedVariable
            using (var appOfflineWrapper = new AppOfflineWrapper(settings))
            {
                var sourceOptions      = WebDeployOptionsFactory.GetSourceOptions();
                var destinationOptions = WebDeployOptionsFactory.GetDestinationOptions(settings);
                destinationOptions.Trace += WebDeployLogger.DestinationOptions_Trace;
                var syncOptions         = WebDeployOptionsFactory.GetSyncOptions(settings);
                var sourceProvider      = DeploymentWellKnownProvider.IisApp;
                var destinationProvider = DeploymentWellKnownProvider.IisApp;
                using (var deploymentObject = DeploymentManager.CreateObject(sourceProvider, settings.SourcePath, sourceOptions))
                {
                    AppendCustomParameters(settings, deploymentObject);
                    deploymentObject.SyncTo(destinationProvider, settings.SiteName, destinationOptions, syncOptions);
                }
            }
        }