共用方式為


DacServices.Publish(DacPackage, String, PublishOptions) Method

Definition

Publish the supplied package to a database. This method supports returning the script used when publishing along with a deployment report summarizing the actions taken during Publish

public Microsoft.SqlServer.Dac.PublishResult Publish (Microsoft.SqlServer.Dac.DacPackage package, string targetDatabaseName, Microsoft.SqlServer.Dac.PublishOptions publishOptions);
member this.Publish : Microsoft.SqlServer.Dac.DacPackage * string * Microsoft.SqlServer.Dac.PublishOptions -> Microsoft.SqlServer.Dac.PublishResult
Public Function Publish (package As DacPackage, targetDatabaseName As String, publishOptions As PublishOptions) As PublishResult

Parameters

package
DacPackage

DacPackage containing schema to be deployed.

targetDatabaseName
String

Name of the target database for deployment.

publishOptions
PublishOptions

Instance of PublishOptions that specifies what is reported back - the deployment script, deployment report, as we all how to configure various aspects of the deployment.

Returns

PublishResult, containing the script(s) and/or report if requested by the caller

Exceptions

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

If an error occurs during deployment.

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

Applies to