将 MSDeploy 用于 dbSqlPackage 提供程序Using MSDeploy with dbSqlPackage Provider

DbSqlPackage 是一个 MSDeploy 提供程序,可使你与 SQL Server/Azure SQL 数据库交互。DbSqlPackage is an MSDeploy provider that allows you interact with SQL Server / Azure SQL Database. DbSqlPackage 支持以下操作:DbSqlPackage supports the following actions:

  • 提取:从活动的 SQL Server 或 Azure SQL 数据库创建数据库快照 (.dacpac) 文件。Extract: Creates a database snapshot (.dacpac) file from a live SQL Server or Azure SQL Database.

  • 发布:增量更新数据库架构以便匹配源 .dacpac 文件的架构。Publish: Incrementally updates a database schema to match the schema of a source .dacpac file.

  • DeployReport:创建将由发布操作完成的更改的 XML 报表。DeployReport: Creates an XML report of the changes that would be made by a publish action.

  • 脚本:创建等效于由发布操作执行的脚本的 Transact-SQL 脚本。Script: Creates a Transact-SQL script equivalent to the script executed by the Publish Action.

有关 DACFx 的详细信息,请参阅 https://msdn.microsoft.com/library/microsoft.sqlserver.dac.aspxSqlPackage.exe(DACFx 命令行工具)上的 DACFx 托管 API 文档。For more information regarding DACFx, please see the DACFx managed API documentation at https://msdn.microsoft.com/library/microsoft.sqlserver.dac.aspx or SqlPackage.exe (DACFx command-line tool).

重要

dbSqlPackage 提供程序功能将从 Visual Studio 的下一个主要版本中删除。The dbSqlPackage provider feature will be removed from the next major release of Visual Studio. 有关如何使用 Web Deploy 进行数据库发布的信息,请参阅用于增量数据库发布的 dbDacFx 提供程序For information on how to do database publishing with Web Deploy, see dbDacFx Provider for Incremental Database publishing.

命令行语法Command Line Syntax

将 MSDeploy 与 dbSqlPackage 提供程序一起使用时,采用以下格式的命令行:MSDeploy with the dbSqlPackage provider uses a command line of the following form:

  
MSDeploy -verb: MSDeploy-verb -source:dbSqlPackage="Input"[,dbSqlPackage-source-parameters] -dest:dpSqlPackage="Input"[,dbSqlPackage-target-parameters]  

MS-Deploy 谓词MS-Deploy Verbs

在 MS-Deploy 命令行上使用 –verb 开关指定 MS-Deploy 谓词。You specify MS-Deploy verbs using the -verb switch on the MS-Deploy command line. dbSqlPackage 提供程序支持以下 MSDeploy 谓词:The dbSqlPackage provider supports the following MSDeploy verbs:

谓词Verb 说明Description
dumpdump 提供 .dacpac 文件中包含的源数据库的信息(包括名称、版本号和说明)。Provides information including name, version number, and description, about a source database contained in a .dacpac file. 在命令行上使用以下格式指定源数据库:Specify the source database using the following format on the command line:

msdeploy -verb:dump -source:dbSqlPackage=".dacpac-file-path"msdeploy -verb:dump -source:dbSqlPackage=".dacpac-file-path"
syncsync 在命令行上使用以下格式指定 dbSqlPackage 操作:Specifies dbSqlPackage actions using the following format on the command line:

msdeploy -verb:sync -source:dbSqlPackage="input" [,DbSqlPackage-source-parameters] -dest:dbSqlPackage="input" [,DbSqlPackage-destination-parameters]msdeploy -verb:sync -source:dbSqlPackage="input" [,DbSqlPackage-source-parameters] -dest:dbSqlPackage="input" [,DbSqlPackage-destination-parameters]

请参阅以下各节以了解同步谓词的有效源和目标参数。See the sections below for the valid source and destination parameters for the sync verb.

dbSqlPackage 源dbSqlPackage Source

dbSqlPackage 提供程序接受是有效 SQL Server/SQL Azure 连接字符串或是 .dacpac 文件磁盘路径的输入。The dbSqlPackage provider takes an input that is either a valid SQL Server/SQL Azure connection string or a path to a .dacpac file on disk. 指定提供程序输入源的语法如下:The syntax for specifying the input source for the provider is the following:

输入Input 默认Default 说明Description
-source:dbSqlPackage= {input}-source:dbSqlPackage={input} 空值N/A input 是有效的 SQL Server 或 SQL Azure 连接字符串,或磁盘上的 .dacpac 文件的路径。input is a valid SQL Server or SQL Azure connection string or a path to a .dacpac file on disk.

注意:使用连接字符串作为输入源时,支持的唯一连接字符串属性是 InitialCatalog、DataSource、UserID、Password、IntegratedSecurity、Encrypt、TrustServerCertificate 和 ConnectionTimeout。NOTE: The only connection string properties supported when using a connection string as an input source are InitialCatalog, DataSource, UserID, Password, IntegratedSecurity, Encrypt, TrustServerCertificate, and ConnectionTimeout.

如果输入源是到 SQL Server/Azure SQL 数据库的连接字符串,dbSqlPackage 将从 SQL Server/Azure SQL 数据库提取 .dacpac 文件形式的数据库快照。If your input source is a connection string to SQL Server / Azure SQL Database, dbSqlPackage will extract a database snapshot in the form of a .dacpac file from SQL Server / Azure SQL Database.

源参数包括:The Source parameters are:

参数Parameter 默认Default 说明Description
Profile:{ string}Profile:{ string} 空值N/A 指定 DAC 发布配置文件的文件路径。Specifies the file path to a DAC Publish Profile. 该配置文件定义在生成结果 dacpac 时要使用的属性和变量的集合。The profile defines a collection of properties and variables to use when generating the resulting dacpac. 发布配置文件会被传递至目标,且在执行 Publish、Script 或 DeployReport 操作之一时被用作默认选项。The publish profile is passed to the destination and used as the default options when performing one a Publish, Script or DeployReport action.
DacApplicationName={ string }DacApplicationName={ string } 数据库名称Database name 定义要在 DACPAC 元数据中存储的应用程序名称。Defines the Application name to be stored in the DACPAC metadata. 默认字符串为数据库名称。The default string is the database name.
DacMajorVersion ={integer}DacMajorVersion ={integer} 11 定义要在 DACPAC 元数据中存储的主版本。Defines the major version to be stored in the DACPAC metadata.
DacMinorVersion={integer}DacMinorVersion={integer} 00 定义要在 DACPAC 元数据中存储的次版本。Defines the minor version to be stored in the DACPAC metadata.
DacApplicationDescription={ string }DacApplicationDescription={ string } 空值N/A 定义要存储在 DACPAC 元数据中的应用程序说明。Defines the Application description to be stored in the DACPAC metadata.
ExtractApplicationScopedObjectsOnly={True | False}ExtractApplicationScopedObjectsOnly={True | False} TrueTrue 如果为 True,则只从源中提取应用程序范围的对象。If True, extracts only application-scoped objects from the source. 如果为 False,则同时提取应用程序范围的对象和非应用程序范围的对象。If False, extracts both application-scoped objects and non-application-scoped objects.
ExtractReferencedServerScopedElements={True | False}ExtractReferencedServerScopedElements={True | False} TrueTrue 如果为 True,则提取源数据库对象所引用的登录对象、服务器审核对象和凭据对象。If True, extract login, server audit and credential objects referenced by source database objects.
ExtractIgnorePermissions={True | False}ExtractIgnorePermissions={True | False} FalseFalse 如果为 True,则忽略提取所有已提取对象的权限;如果为 False,则不这样做。If True, ignores extracting permissions for all extracted objects; if False, does not.
ExtractStorage={File|Memory}ExtractStorage={File|Memory} FileFile 指定在提取过程中使用的架构模型的后备存储的类型。Specifies the type of backing storage for the schema model used during extraction.
ExtractIgnoreExtendedProperties={True|False}ExtractIgnoreExtendedProperties={True|False} FalseFalse 指定是否应忽略扩展属性。Specifies whether extended properties should be ignored.
VerifyExtraction = {True|False}VerifyExtraction = {True|False} FalseFalse 指定是否应验证提取的 dacpac。Specifies whether the extracted dacpac should be verified.

DbSqlPackage 目标DbSqlPackage Destination

dbSqlPackage 提供程序接受是有效 SQL Server/SQL Azure 连接字符串或是 .dacpac 文件磁盘路径的输入作为目标输入。The dbSqlPackage provider accepts either a valid SQL Server/SQL Azure connection string or a path to a .dacpac file on disk as the destination input. 指定提供程序目标的语法如下:The syntax for specifying the destination for the provider is the following:

输入Input 默认Default 说明Description
-dest:dbSqlPackage={input}-dest:dbSqlPackage={input} 空值N/A input 是有效的 SQL Server 或 SQL Azure 连接字符串,或磁盘上的 .dacpac 文件的完整或部分路径。input is a valid SQL Server or SQL Azure connection string or a full or partial path to a .dacpac file on disk. 如果 input 是文件路径,则不可指定其他参数。If input is a file path, no other parameters may be specified.

以下目标参数可用于所有 dbSqlPackage 操作:The following Destination parameters are available for all dbSqlPackage operations:

属性Property 默认Default 说明Description
Action={Publish|DeployReport|Script}Action={Publish|DeployReport|Script} 空值N/A 可选参数,它们指定要在目标处执行的操作。Optional parameter specifying the action to perform at the Destination.
AllowDropBlockingAssemblies ={True | False}AllowDropBlockingAssemblies ={True | False} FalseFalse 指定 SqlClr 发布是否删除作为部署计划的一部分的阻塞程序集。Specifies whether SqlClr publishing drops blocking assemblies as part of the deployment plan. 默认情况下,如果必须删除引用程序集,则任何阻塞或引用程序集将阻止程序集更新。By default, any blocking or referencing assemblies block an assembly update if the referencing assembly must be dropped.
AllowIncompatiblePlatform={True | False}AllowIncompatiblePlatform={True | False} FalseFalse 指定发布操作是否应继续进行,而不管可能存在的不兼容 SQL Server 平台。Specifies whether the publish action should go forward despite potentially incompatible SQL Server platforms.
BackupDatabaseBeforeChanges={True | False}BackupDatabaseBeforeChanges={True | False} FalseFalse 在部署任何更改之前,备份数据库。Backups the database before deploying any changes.
BlockOnPossibleDataLoss={ True | False}BlockOnPossibleDataLoss={ True | False} TrueTrue 指定在发布操作可能导致数据丢失的情况下,是否终止发布集。Specifies whether the publish episode is terminated if the publish operation might cause data loss.
BlockWhenDriftDetected={ True | False}BlockWhenDriftDetected={ True | False} TrueTrue 指定是否阻止更新其架构与其注册不再匹配或已取消注册的数据库。Specifies whether to block updating a database whose schema no longer matches its registration or is unregistered.
CommentOutSetVarDeclarations= {True | False}CommentOutSetVarDeclarations= {True | False} FalseFalse 指定是否在生成的发布脚本中注释掉 SETVAR 变量声明。Specifies whether SETVAR variable declarations are commented out in the generated publish script. 如果你计划在发布时使用 SQLCMD.exe 等工具指定命令行上的值,则可以选择这样做。You might choose to do this if you plan to use a tool such as SQLCMD.exe to specify the values on the command line when you publish.
CompareUsingTargetCollation={ True | False}CompareUsingTargetCollation={ True | False} FalseFalse 此设置指示在部署过程中如何处理数据库的排序规则;默认情况下,如果目标数据库的排序规则与源所指定的排序规则不匹配,就将更新目标数据库的排序规则。This setting dictates how the database's collation is handled during deployment; by default the target database's collation will be updated if it does not match the collation specified by the source. 设置此选项后,应使用目标数据库(或服务器)的排序规则。When this option is set, the target database's (or server's) collation should be used.
CreateNewDatabase={ True | False}CreateNewDatabase={ True | False} FalseFalse 指定当您发布到数据库时,是否应更新目标数据库或是否应删除并重新创建目标数据库。Specifies whether the target database should be updated or whether it should be dropped and re-created when you publish to a database.
DeployDatabaseInSingleUserMode={ True | False}DeployDatabaseInSingleUserMode={ True | False} FalseFalse 如果为 True,则数据库在部署前将设置为单用户模式。If True, the database is set to Single User Mode before deploying.
DisableAndReenableDdlTriggers={True | False}DisableAndReenableDdlTriggers={True | False} TrueTrue 指定在发布过程开始时是否禁用数据定义语言 (DDL) 触发器,以及在发布操作结束时是否重新启用此类触发器。Specifies whether Data Definition Language (DDL) triggers are disabled at the beginning of the publish process and re-enabled at the end of the publish action.
DoNotAlterChangeDataCaptureObjects={ True | False}DoNotAlterChangeDataCaptureObjects={ True | False} TrueTrue 如果为 True,则不更改变更数据捕获对象。If True, Change Data Capture objects are not altered.
DoNotAlterReplicatedObjects=( True | False}DoNotAlterReplicatedObjects=( True | False} TrueTrue 指定是否在验证过程中标识重复的对象。Specifies whether objects that are replicated are identified during verification.
DropConstraintsNotInSource= {True | False}DropConstraintsNotInSource= {True | False} TrueTrue 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的约束。Specifies whether the publish action drops constraints that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
DropDmlTriggersNotInSource= {True | False}DropDmlTriggersNotInSource= {True | False} TrueTrue 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的数据操作语言 (DML) 触发器。Specifies whether the publish action drops Data Manipulation Language (DML) triggers that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
DropExtendedPropertiesNotInSource= {True | False}DropExtendedPropertiesNotInSource= {True | False} TrueTrue 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的扩展属性。Specifies whether the publish action drops extended properties that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
DropIndexesNotInSource= {True | False}DropIndexesNotInSource= {True | False} TrueTrue 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的索引。Specifies whether the publish action drops indexes that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
DropObjectsNotInSource= {True | False}DropObjectsNotInSource= {True | False} FalseFalse 指定当你发布到数据库时,是否将从目标数据库中删除数据库快照 (.dacpac) 文件中不存在的对象。Specifies whether objects that do not exist in the database snapshot (.dacpac) file will be dropped from the target database when you publish to a database.
DropPermissionsNotInSource= {True | False}DropPermissionsNotInSource= {True | False} FalseFalse 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的权限。Specifies whether the publish action permissions that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
DropRoleMembersNotInSource= {True | False}DropRoleMembersNotInSource= {True | False} FalseFalse 指定当您发布到数据库时,发布操作是否从目标数据库中删除数据库快照 (.dacpac) 中不存在的角色成员。Specifies whether the publish action drops role members that do not exist in the database snapshot (.dacpac) from the target database when you publish to a database.
GenerateSmartDefaults={True | False}GenerateSmartDefaults={True | False} FalseFalse 指定当 SqlPackage.exe 使用一个不允许 Null 值的列更新一个包含数据的表时,是否自动提供默认值。Specifies whether SqlPackage.exe provides a default value automatically when it updates a table that contains data with a column that does not allow null values.
IgnoreAnsiNulls= {True | False}IgnoreAnsiNulls= {True | False} FalseFalse 指定当你发布到数据库时,是忽略还是更新 ANSI NULLS 设置之间的差异。Specifies whether to ignore or update differences in the ANSI NULLS setting when you publish to a database.
IgnoreAuthorizer= {True | False}IgnoreAuthorizer= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新授权者之间的差异。Specifies whether to ignore or update differences in the Authorizer when you publish to a database.
IgnoreColumnCollation= {True | False}IgnoreColumnCollation= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新列排序规则之间的差异。Specifies whether to ignore or update differences in column collation when you publish to a database.
IgnoreComments= {True | False}IgnoreComments= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新注释顺序之间的差异。Specifies whether to ignore or update differences in comments order when you publish to a database.
IgnoreCryptographicProviderFile= {True | False}IgnoreCryptographicProviderFile= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新加密提供程序的文件路径之间的差异。Specifies whether to ignore or update differences in the file path for a cryptographic provider when you publish to a database.
IgnoreDdlTriggerOrder= {True | False}IgnoreDdlTriggerOrder= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新数据定义语言 (DDL) 触发器顺序之间的差异。Specifies whether to ignore or update differences in the order of Data Definition Language (DDL) triggers when you publish to a database.
IgnoreDdlTriggerState={True | False}IgnoreDdlTriggerState={True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新 DDL 触发器的已启用状态或已禁用状态之间的差异。Specifies whether to ignore or update differences in the enabled or disabled state of DDL triggers when you publish to a database.
IgnoreDefaultSchema={True | False}IgnoreDefaultSchema={True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新默认架构之间的差异。Specifies whether to ignore or update differences in the default schema when you publish to a database.
IgnoreDmlTriggerOrder= {True | False}IgnoreDmlTriggerOrder= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新 DML 触发器顺序之间的差异。Specifies whether to ignore or update differences in the order of DML triggers when you publish to a database.
IgnoreDmlTriggerState= {True | False}IgnoreDmlTriggerState= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新 DML 触发器的已启用状态或已禁用状态之间的差异。Specifies whether to ignore or update differences in the enabled or disabled state of DML triggers when you publish to a database.
IgnoreExtendedProperties= {True | False}IgnoreExtendedProperties= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新扩展属性之间的差异。Specifies whether to ignore or update differences in extended properties when you publish to a database.
IgnoreFileAndLogFilePath={True | False}IgnoreFileAndLogFilePath={True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新文件和日志文件的路径之间的差异。Specifies whether to ignore or update differences in the paths for files and log files when you publish to a database.
IgnoreFilegroupPlacement= {True | False}IgnoreFilegroupPlacement= {True | False} TrueTrue 指定当你发布到数据库时,是忽略还是更新 FILEGROUP 的位置之间的差异。Specifies whether to ignore or update differences in the placement of FILEGROUP s when you publish to a database.
IgnoreFileSize= {True | False}IgnoreFileSize= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新文件大小之间的差异。Specifies whether to ignore or update differences in file sizes when you publish to a database.
IgnoreFillFactor= {True | False}IgnoreFillFactor= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新填充因子之间的差异。Specifies whether to ignore or update differences in fill factors when you publish to a database.
属性Property 默认Default 说明Description
IgnoreFullTextCatalogFilePath= {True | False}IgnoreFullTextCatalogFilePath= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新全文索引文件的路径之间的差异。Specifies whether to ignore or update differences in the path to full-text index files when you publish to a database.
IgnoreIdentitySeed= {True | False}IgnoreIdentitySeed= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新标识列的种子之间的差异。Specifies whether to ignore or update differences in the seed for an identity column when you publish to a database.
IgnoreIncrement= {True | False}IgnoreIncrement= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新标识列的增量之间的差异。Specifies whether to ignore or update differences in the increment for an identity column when you publish to a database.
IgnoreIndexOptions ={True | False}IgnoreIndexOptions ={True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新索引选项之间的差异。Specifies whether to ignore or update differences in the index options when you publish to a database.
IgnoreIndexPadding= {True | False}IgnoreIndexPadding= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新索引填充之间的差异。Specifies whether to ignore or update differences in the index padding when you publish to a database.
IgnoreKeywordCasing= {True | False}IgnoreKeywordCasing= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新关键字大小写之间的差异。Specifies whether to ignore or update differences in the keyword casing when you publish to a database.
IgnoreLockHintsOnIndexes= {True | False}IgnoreLockHintsOnIndexes= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新索引上的锁提示之间的差异。Specifies whether to ignore or update differences in the lock hints on indexes when you publish to a database.
IgnoreLoginSids= {True | False}IgnoreLoginSids= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新安全标识符 (SID) 之间的差异。Specifies whether to ignore or update differences in the security identifier (SID) when you publish to a database.
IgnoreNotForReplication= {True | False}IgnoreNotForReplication= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新 not-for-replication 设置之间的差异。Specifies whether to ignore or update the not-for-replication setting when you publish to a database.
IgnoreObjectPlacementOnPartitionScheme= {True | False}IgnoreObjectPlacementOnPartitionScheme= {True | False} TrueTrue 指定当发布到数据库时,是忽略还是更新对象在分区方案上的位置之间的差异。Specifies whether to ignore or update an object's placement on a partition scheme when you publish to a database.
IgnorePartitionSchemes= {True | False}IgnorePartitionSchemes= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新分区方案和函数之间的差异。Specifies whether to ignore or update differences in partition schemes and functions when you publish to a database.
IgnorePermissions= {True | False}IgnorePermissions= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新权限之间的差异。Specifies whether to ignore or update differences in permissions when you publish to a database.
IgnoreQuotedIdentifiers= {True | False}IgnoreQuotedIdentifiers= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新带引号的标识符设置之间的差异。Specifies whether to ignore or update differences in quoted identifier settings when you publish to a database.
IgnoreRoleMembership={True | False}IgnoreRoleMembership={True | False} FalseFalse 指定当您发布到数据库时,应忽略还是更新登录的角色成员身份之间的差异。Specifies whether differences in the role membership of logins should be ignored or updated when you publish to a database.
IgnoreRouteLifetime= {True | False}IgnoreRouteLifetime= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新登录的角色成员身份之间的差异。Specifies whether to ignore or update differences in the role memberships of logins when you publish to a database.
IgnoreSemicolonBetweenState= {True | False}IgnoreSemicolonBetweenState= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新 Transact-SQL 语句之间的分号的差异。Specifies whether to ignore or update differences in semicolons between Transact-SQL statements when you publish to a database.
IgnoreTableOptions= {True | False}IgnoreTableOptions= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新表选项之间的差异。Specifies whether to ignore or update differences in table options when you publish to a database.
IgnoreUserSettingsObjects= {True | False}IgnoreUserSettingsObjects= {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新用户设置选项之间的差异。Specifies whether to ignore or update differences in user setting options when you publish to a database.
IgnoreWhitespace= {True | False}IgnoreWhitespace= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新空白中的差异。Specifies whether to ignore or update differences in whitespace when you publish to a database.
IgnoreWithNocheckOnCheckConstraints={True | False}IgnoreWithNocheckOnCheckConstraints={True | False} FalseFalse 指定当你发布到数据库时,是忽略还是更新用于 CHECK 约束的 WITH NOCHECK 子句的值之间的差异。Specifies whether to ignore or update differences in the value of the WITH NOCHECK clause for check constraints when you publish to a database.
IgnoreWithNocheckOnForeignKeys={True | False}IgnoreWithNocheckOnForeignKeys={True | False} FalseFalse 指定当你发布到数据库时,是忽略还是更新用于外键的 WITH NOCHECK 子句的值之间的差异。Specifies whether to ignore or update differences in the value of the WITH NOCHECK clause for foreign keys when you publish to a database.
IncludeCompositeObjects= {True | False}IncludeCompositeObjects= {True | False} FalseFalse 指定是否将所有复合元素作为单个发布操作的一部分包含。Specifies whether to include all composite elements as part of a single publish operation.
IncludeTransactionalScripts={True | False}IncludeTransactionalScripts={True | False} FalseFalse 指定当您发布到数据库时,是否在任何可能的位置使用事务性语句。Specifies whether to use transactional statements wherever possible when you publish to a database.
NoAlterStatementsToChangeClrTypes={True | False}NoAlterStatementsToChangeClrTypes={True | False} FalseFalse 指定发布操作在存在差异时应始终删除并重新创建程序集,而不是发出 ALTER ASSEMBLY 语句。Specifies that publish should always drop and re-create an assembly if there is a difference instead of issuing an ALTER ASSEMBLY statement.
PopulateFilesOnFilegroups= {True | False}PopulateFilesOnFilegroups= {True | False} TrueTrue 指定当你在目标数据库中创建一个新的 FileGroup 时,是否也创建一个新文件。Specifies whether a new file is also created when you create a new FileGroup in the target database.
RegisterDataTierApplication={True | False}RegisterDataTierApplication={True | False} FalseFalse 指定是否向数据库服务器注册该架构。Specifies whether the schema is registered with the database server.
ScriptDatabaseCollation {True | False}ScriptDatabaseCollation {True | False} FalseFalse 指定当您发布到数据库时,是忽略还是更新数据库排序规则之间的差异。Specifies whether to ignore or update differences in database collation when you publish to a database.
ScriptDatabaseCompatibility= {True | False}ScriptDatabaseCompatibility= {True | False} TrueTrue 指定当您发布到数据库时,是忽略还是更新数据库兼容性之间的差异。Specifies whether to ignore or update differences in database compatibility when you publish to a database.
ScriptDatabaseOptions= {True | False}ScriptDatabaseOptions= {True | False} TrueTrue 指定当您发布到数据库时,是设置还是更新目标数据库属性。Specifies whether to set or update target database properties when you publish to a database.
ScriptFileSize={True | False}ScriptFileSize={True | False} FalseFalse 控制在向文件组添加文件时是否指定大小。Controls whether size is specified when adding a file to a filegroup.
ScriptNewConstraintValidation= {True | False}ScriptNewConstraintValidation= {True | False} TrueTrue 指定在发布结束时是否将所有约束作为一个集合进行验证,从而避免 CHECK 约束或外键约束在发布操作过程中导致数据错误。Specifies whether to verify all constraints as one set at the end of publishing, avoiding data errors caused by a check or foreign key constraint in the middle of the publish action. 如果此选项为 False,则将发布约束而不检查相应的数据。If this option is False, constraints are published without checking the corresponding data.
ScriptDeployStateChecks={True | False}ScriptDeployStateChecks={True | False} FalseFalse 指定是否在发布脚本中生成语句以验证数据库名称和服务器名称是否与数据库项目中指定的名称匹配。Specifies whether to generate statements in the publish script to verify that the database and server names match the names specified in the database project.
ScriptRefreshModule= {True | False}ScriptRefreshModule= {True | False} TrueTrue 指定是否在发布脚本的结尾处包含刷新语句。Specifies whether to include refresh statements at the end of the publish script.
Storage={File|Memory}Storage={File|Memory} 内存Memory 指定在生成数据库模型时如何存储元素。Specifies how elements are stored when building the database model. 出于性能原因,默认值为 Memory。For performance reasons the default is Memory. 对于非常大的数据库,需要文件备份的存储。For very large databases, File backed storage is required.
TreatVerificationErrorsAsWarnings= {True | False}TreatVerificationErrorsAsWarnings= {True | False} FalseFalse 指定是否将发布验证过程中出现的错误视为警告。Specifies whether to treat errors that occur during publish verification as warnings. 在对目标数据库执行生成的部署计划之前,会先对该计划执行检查。The check is performed against the generated deployment plan before the plan is executed against the target database. 计划验证将检测仅有目标的对象(如索引)丢失等问题,必须解决这些问题以进行更改。Plan verification detects problems, such as the loss of target-only objects (for example, indexes), that must be dropped to make a change. 验证还检测以下情况:依赖项(如表或视图)因对复合项目的引用而存在,但未存在于目标数据库中。Verification also detects situations where dependencies (such as tables or views) exist because of a reference to a composite project, but do not exist in the target database. 您可选择将验证错误视为警告以获取问题的完整列表,而不是允许发布操作在出现第一个错误时停止。You might choose to treat verification errors as warnings to get a complete list of issues instead of allowing the publish action to stop when the first error occurs.
UnmodifiableObjectWarnings= {True | False}UnmodifiableObjectWarnings= {True | False} TrueTrue 指定在无法修改的对象中发现差异(例如,如果文件的大小或路径存在差异)时是否生成警告。Specifies whether to generate warnings when differences are found in objects that cannot be modified (for example, if the file size or file paths are different for a file).
VerifyCollationCompatibility={True | False}VerifyCollationCompatibility={True | False} TrueTrue 指定是否验证排序规则兼容性。Specifies whether collation compatibility is verified.
VerifyDeployment={True | False}VerifyDeployment={True | False} TrueTrue 指定在出现可能阻止成功发布的问题的情况下,是否在发布前执行将停止发布操作的检查。Specifies whether to perform checks before publishing that stop the publish action if issues are present that might block successful publishing. 例如,如果您在发布过程中收到错误,则发布操作可能会停止,因为数据库项目中不存在目标数据库上的外键。For example, your publish action might stop if you get errors during publishing because foreign keys on the target database do not exist in the database project.

备注

指定的任何目标参数将覆盖源发布配置文件中指定的目标参数。Any destination parameters specified will override those specified in the source Publish Profile.

备注

必须在发布配置文件源参数中指定 SQLCMD 变量和值,因为不能将它们指定为目标参数。SQLCMD variables and values must be specified in the Publish Profile source parameter, as they cannot be specified as a destination parameter.

以下目标参数仅限用于 DeployReport 和 Script 操作:The following Destination parameters are available for DeployReport and Script operations only:

参数Parameter 默认Default 说明Description
OutputPath={ string }OutputPath={ string } 空值N/A 可选参数,它通知 dbSqlPackage 在 string 指定的磁盘位置创建 DeployReport XML 输出文件或 Script SQL 输出文件。Optional parameter that tells dbSqlPackage to create the DeployReport XML output file or Script SQL output file in the disk location specified by string. 此操作会覆盖当前驻留在 string 指定的位置的任何脚本。This action overwrites any scripts that currently reside in the location given by string.

备注

如果没有为 DeployReport 或 Script 操作提供 OutputPath 参数,则会以消息的形式返回输出结果。If OutputPath parameter is not provided for a DeployReport or Script action, the output is returned as a message.

示例Examples

下面是使用 dbSqlPackage 的 Extract 操作的示例语法:The following is example syntax for an Extract operation using dbSqlPackage:

MSDeploy.exe -verb:sync -source:dbSqlPackage="<source connection string>",<source parameter> -dest:dbSqlPackage="<target dacpac file path>"  

下面是使用 dbSqlPackage 的 Publish 操作的示例语法:The following is example syntax for a Publish operation using dbSqlPackage:

MSDeploy.exe -verb:sync -source:dbSqlPackage="<source dacpac file path>" -dest:dbSqlPackage="<target SQL Server/SQL Azure connection string>",Action=Publish,<destination parameters>  

下面是使用 dbSqlPackage 的 DeployReport 操作的示例语法:The following is example syntax for a DeployReport operation using dbSqlPackage:

MSDeploy.exe -verb:sync -source:dbSqlPackage="<source dacpac file path>" -dest:dbSqlPackage="<target SQL Server/SQL Azure connection string>",Action=DeployReport,OutputPath="<path to output XML file>",<destination parameters>  

下面是使用 dbSqlPackage 的 操作的示例语法:The following is example syntax for a Script operation using dbSqlPackage:

MSDeploy.exe -verb:sync -source:dbSqlPackage="<source dacpac file path>" -dest:dbSqlPackage="<target SQL Server/SQL Azure connection string>",Action=Script,OutputPath="<path to output sql script>",<destination parameters>