Freigeben über


DeploymentSyncOptions Konstruktoren

Definition

Überlädt

DeploymentSyncOptions()

Erstellt eine Instanz von DeploymentSyncOptions.

public:
 DeploymentSyncOptions();
public DeploymentSyncOptions ();
Public Sub New ()

Beispiele

Im folgenden Beispiel wird die -Klasse DeploymentSyncOptionsimplementiert, indem die statische Methode GetAvailableRules aufgerufen wird, um derzeit verfügbare Regeln abzurufen, die für den Synchronisierungsvorgang gelten. Eine DeploymentSyncOptions Instanz ändert dann eigenschaften: WhatIf und UseChecksum.

Hinweis Die WhatIf -Eigenschaft ermöglicht die Durchführung einer Testsynchronisierung, um die Möglichkeit eines Synchronisierungsvorgangs zu ermitteln und eine Messung der Änderungen bereitzustellen, die bei der Verwendung in Verbindung mit einer Instanz von DeploymentChangeSummaryauftreten können.

using System;

using Microsoft.Web.Deployment;

namespace MSDeploy.Web.Deployment

{

class Program

{

static void Main(string[] args)

{

// List currently available rules

foreach(DeploymentRule rule in

DeploymentSyncOptions.GetAvailableRules())

{

Console.WriteLine("Description: " + rule.Description);

Console.WriteLine("ExampleOrDetail: " + rule.ExampleOrDetail);

Console.WriteLine("FriendlyName: " + rule.FriendlyName);

Console.WriteLine("Name: " + rule.Name);

Console.WriteLine("Handler: " +

rule.RuleHandler.ToString());

Console.WriteLine();

}

DeploymentSyncOptions syncOptions = new DeploymentSyncOptions();

syncOptions.WhatIf = true; // report expected results of

// syncing without performing a sync operation

syncOptions.UseChecksum = true; // compare files through

// checksum to determine if they should be synced

DeploymentBaseOptions sourceBaseOptions =

new DeploymentBaseOptions();

DeploymentBaseOptions destinationBaseOptions =

new DeploymentBaseOptions();

DeploymentObject deploymentObject =

DeploymentManager.CreateObject(

DeploymentWellKnownProvider.AppHostConfig,

"Default Web Site", sourceBaseOptions);

DeploymentChangeSummary changes =

deploymentObject.SyncTo(

DeploymentWellKnownProvider.AppHostConfig,

"Default Web Site2", destinationBaseOptions,

syncOptions);

Console.WriteLine("Added: " +

changes.ObjectsAdded.ToString());

Console.WriteLine("Updated: " +

changes.ObjectsUpdated.ToString());

Console.WriteLine("Deleted: " +

changes.ObjectsDeleted.ToString());

Console.WriteLine("Errors: " +

changes.Errors.ToString());

}

}

}

Gilt für:

DeploymentSyncOptions(SerializationInfo, StreamingContext)

protected:
 DeploymentSyncOptions(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected DeploymentSyncOptions (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new Microsoft.Web.Deployment.DeploymentSyncOptions : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> Microsoft.Web.Deployment.DeploymentSyncOptions
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameter

Gilt für: