DeploymentWellKnownProvider Enumeration

IIS 7.0

Defines the list of known deployment provider factories.

Namespace:  Microsoft.Web.Deployment
Assembly:  Microsoft.Web.Deployment (in Microsoft.Web.Deployment.dll)

public enum DeploymentWellKnownProvider

This list contains the default provider factories shipped with the Microsft.Web.Deployment assembly. Additional implementations created by third-parties are not listed in this enumeration.

The following example uses the enumeration DeploymentWellKnownProvider to implement a sync operation with the method SyncTo. DeploymentWellKnownProvider is a safer method of using shipped providers compared to manually inputted strings, which is an offered overload of CreateObject.

NoteNote:

The switch statement helps to demonstrate the various elements in the enumeration

using System;

using Microsoft.Web.Deployment;

namespace MSDeploy.Web.Deployment

{

class Program

{

public enum OSVersion

{

Windows2003,

Windows2008,

}

public enum SyncTypes

{

Content,

File,

Server

}

static void Main(string[] args)

{

string _path = args[0];

OSVersion _osVersion = OSVersion.Windows2003;

SyncTypes _syncType = SyncTypes.Server;

DeploymentWellKnownProvider _provider =

DeploymentWellKnownProvider.Unknown;

switch (_syncType)

{

case SyncTypes.Content:

_provider =

DeploymentWellKnownProvider.ContentPath;

break;

case SyncTypes.File:

_provider = DeploymentWellKnownProvider.FilePath;

break;

case SyncTypes.Server:

if (_osVersion == OSVersion.Windows2003)

{

_provider = DeploymentWellKnownProvider.WebServer60;

}

else if (_osVersion == OSVersion.Windows2008)

{

_provider = DeploymentWellKnownProvider.AppHostConfig;

}

break;

default:

throw new NotImplementedException();

}

DeploymentSyncOptions syncOptions =

new DeploymentSyncOptions();

DeploymentBaseOptions sourceBaseOptions =

new DeploymentBaseOptions();

DeploymentBaseOptions destinationBaseOptions =

new DeploymentBaseOptions();

DeploymentObject deploymentObject =

DeploymentManager.CreateObject(

provider, path, sourceBaseOptions);

deploymentObject.SyncTo(

provider,_path, destinationBaseOptions, syncOptions);

}

}

}

Show: