正如标题所说,尝试使用发布配置文件 XML 发布时出现此错误:
DropExtendedPropertiesNotInSource 与选定的 DoNotDropObjectType ExtendedProperties 冲突
我已指定在目标中删除不在源中的对象,但已排除除表和同义词之外的所有内容。以下是我认为与此错误有关的两行:
<DropObjectsNotInSource>True</DropObjectsNotInSource>
<DoNotDropExtendedProperties>True</DoNotDropExtendedProperties>
下面是完整的发布配置文件,已删除目标数据库信息。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseName>REDACTED</TargetDatabaseName>
<DeployScriptFileName>REDACTED.sql</DeployScriptFileName>
<TargetConnectionString>Data Source=REDACTED;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True</TargetConnectionString>
<BlockOnPossibleDataLoss>True</BlockOnPossibleDataLoss>
<DropObjectsNotInSource>True</DropObjectsNotInSource>
<DoNotDropAggregates>True</DoNotDropAggregates>
<DoNotDropApplicationRoles>True</DoNotDropApplicationRoles>
<DoNotDropAssemblies>True</DoNotDropAssemblies>
<DoNotDropAsymmetricKeys>True</DoNotDropAsymmetricKeys>
<DoNotDropAudits>True</DoNotDropAudits>
<DoNotDropBrokerPriorities>True</DoNotDropBrokerPriorities>
<DoNotDropCertificates>True</DoNotDropCertificates>
<DoNotDropClrUserDefinedTypes>True</DoNotDropClrUserDefinedTypes>
<DoNotDropColumnEncryptionKeys>True</DoNotDropColumnEncryptionKeys>
<DoNotDropColumnMasterKeys>True</DoNotDropColumnMasterKeys>
<DoNotDropContracts>True</DoNotDropContracts>
<DoNotDropCredentials>True</DoNotDropCredentials>
<DoNotDropCryptographicProviders>True</DoNotDropCryptographicProviders>
<DoNotDropDatabaseAuditSpecifications>True</DoNotDropDatabaseAuditSpecifications>
<DoNotDropDatabaseRoles>True</DoNotDropDatabaseRoles>
<DoNotDropDatabaseScopedCredentials>True</DoNotDropDatabaseScopedCredentials>
<DoNotDropDatabaseTriggers>True</DoNotDropDatabaseTriggers>
<DoNotDropDefaults>True</DoNotDropDefaults>
<DoNotDropEndpoints>True</DoNotDropEndpoints>
<DoNotDropErrorMessages>True</DoNotDropErrorMessages>
<DoNotDropEventSessions>True</DoNotDropEventSessions>
<DoNotDropEventNotifications>True</DoNotDropEventNotifications>
<DoNotDropExtendedProperties>True</DoNotDropExtendedProperties>
<DoNotDropExternalDataSources>True</DoNotDropExternalDataSources>
<DoNotDropExternalFileFormats>True</DoNotDropExternalFileFormats>
<DoNotDropExternalTables>True</DoNotDropExternalTables>
<DoNotDropFileTables>True</DoNotDropFileTables>
<DoNotDropFilegroups>True</DoNotDropFilegroups>
<DoNotDropFullTextCatalogs>True</DoNotDropFullTextCatalogs>
<DoNotDropFullTextStoplists>True</DoNotDropFullTextStoplists>
<DoNotDropLinkedServerLogins>True</DoNotDropLinkedServerLogins>
<DoNotDropLinkedServers>True</DoNotDropLinkedServers>
<DoNotDropLogins>True</DoNotDropLogins>
<DoNotDropMessageTypes>True</DoNotDropMessageTypes>
<DoNotDropPartitionFunctions>True</DoNotDropPartitionFunctions>
<DoNotDropPartitionSchemes>True</DoNotDropPartitionSchemes>
<DoNotDropPermissions>True</DoNotDropPermissions>
<DoNotDropQueues>True</DoNotDropQueues>
<DoNotDropRemoteServiceBindings>True</DoNotDropRemoteServiceBindings>
<DoNotDropRoutes>True</DoNotDropRoutes>
<DoNotDropRoleMembership>True</DoNotDropRoleMembership>
<DoNotDropRules>True</DoNotDropRules>
<DoNotDropScalarValuedFunctions>True</DoNotDropScalarValuedFunctions>
<DoNotDropSearchPropertyLists>True</DoNotDropSearchPropertyLists>
<DoNotDropSecurityPolicies>True</DoNotDropSecurityPolicies>
<DoNotDropSequences>True</DoNotDropSequences>
<DoNotDropServerAuditSpecifications>True</DoNotDropServerAuditSpecifications>
<DoNotDropServerRoles>True</DoNotDropServerRoles>
<DoNotDropServerRoleMembership>True</DoNotDropServerRoleMembership>
<DoNotDropServices>True</DoNotDropServices>
<DoNotDropServerTriggers>True</DoNotDropServerTriggers>
<DoNotDropSignatures>True</DoNotDropSignatures>
<DoNotDropStoredProcedures>True</DoNotDropStoredProcedures>
<DoNotDropSymmetricKeys>True</DoNotDropSymmetricKeys>
<DoNotDropSynonyms>False</DoNotDropSynonyms>
<DoNotDropTableValuedFunctions>True</DoNotDropTableValuedFunctions>
<DoNotDropUserDefinedDataTypes>True</DoNotDropUserDefinedDataTypes>
<DoNotDropUserDefinedTableTypes>True</DoNotDropUserDefinedTableTypes>
<DoNotDropUsers>True</DoNotDropUsers>
<DoNotDropViews>True</DoNotDropViews>
<ExcludeUsers>True</ExcludeUsers>
<ExcludeLogins>True</ExcludeLogins>
<ProfileVersionNumber>1</ProfileVersionNumber>
<ExcludeFullTextCatalogs>True</ExcludeFullTextCatalogs>
<IgnoreIndexOptions>True</IgnoreIndexOptions>
<DoNotDropXmlSchemaCollections>True</DoNotDropXmlSchemaCollections>
</PropertyGroup>
</Project>
文档说明
DropExtendedPropertiesNotInSource
默认值为 true。因此,您需要将其设置
False
为以纠正此问题。不幸的是,Visual Studio 中的 SSDT 用户界面似乎有点在欺骗我们,这可能就是您最终遇到这种情况的原因。
默认情况下,在 UI
DropExtendedPropertiesNotInSource
中设置为True
(与文档一致 - 好?):当您选中“在目标中放置对象但不在源中放置对象”选项时,该底部部分将被禁用,并且“退出”复选框列表已启用:
这可能会让您觉得这些选项已设置为 false,但它们并没有 - 糟糕 ?
您需要手动取消选中它们(首先取消选中“在目标中放置对象但不在源中”,然后取消选中底部的选项,然后重新选中“在目标中放置对象......”):
如果您不使用 UI,那么这些是需要添加到发布 XML 文件的元素:
不幸的是,我无法重现您遇到的错误(我正在使用 Visual Studio 2019 版本 16.4.0 和 SSDT 16.0.61911.11100 进行测试),但我希望添加这些明确的“False”选项可以解决问题。