DacServices.Deploy Method

Definition

Deploy the supplied package to a database.

public void Deploy (Microsoft.SqlServer.Dac.DacPackage package, string targetDatabaseName, bool upgradeExisting = false, Microsoft.SqlServer.Dac.DacDeployOptions options = default, System.Threading.CancellationToken? cancellationToken = default);
member this.Deploy : Microsoft.SqlServer.Dac.DacPackage * string * bool * Microsoft.SqlServer.Dac.DacDeployOptions * Nullable<System.Threading.CancellationToken> -> unit
Public Sub Deploy (package As DacPackage, targetDatabaseName As String, Optional upgradeExisting As Boolean = false, Optional options As DacDeployOptions = Nothing, Optional cancellationToken As Nullable(Of CancellationToken) = Nothing)

Parameters

package
DacPackage

DacPackage containing schema to be deployed.

targetDatabaseName
String

Name of the target database for deployment.

upgradeExisting
Boolean

True to allow modification of existing database schema in order to match schema contained in source package; otherwise false to block modification of existing database. If the database does not exist this flag has no effect.

options
DacDeployOptions

Instance of DacDeployOptions that specifies properties that affect various aspects of the deployment.

cancellationToken
Nullable<CancellationToken>

Optional CancellationToken that can be used to indicate that the operation should be cancelled. Use of this object does not guarantee that the operation will be cancelled.

Exceptions

If the value for any of the required parameters is a null reference or an empty string.

If upgradeExisting is true and the target database exists; or if an error occurs during deployment.

If the CancellationToken has a cancellation requested and the operation could be cancelled.

Applies to