SQL Dacpac Deploy using SqlPackage and DropObjectsNotInSource with DoNotDropUsers

浪尽此生 提交于 2019-12-13 13:54:11

问题


I am running SqlPackage in my CI build to deploy dacpacs and pass in a publish.xml file using the /Profile switch. I have the following three options set in the profile:

<DropObjectsNotInSource>True</DropObjectsNotInSource>
<DoNotDropPermissions>True</DoNotDropPermissions>
<DoNotDropUsers>True</DoNotDropUsers>

However when I run the dacpac deploy it still tries to drop my users. Any ideas?


回答1:


There is (unfortunately) a bug in SqlPackage.exe's handling of publish profiles, whereby the DoNotDrop and Exclude options are not honored. This will be fixed in an upcoming version of SqlPackage.exe. In the meantime have you tried using this SqlPackage.exe command line argument?

/p:DoNotDropObjectTypes=Permissions;Users



回答2:


Check the timestamp and version on your SqlPackage.exe. You may be calling the wrong one.

The one that will honor the DoNotDrop and Exclude options should be stamped 7/30/2015 3:04AM, versioned 12.0.3021.1 and be located here: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120

The other one (which does not honor these settings) is stamped 3/28/2014 10:56pm, versioned 12.0.1294.0 and is at C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin



来源:https://stackoverflow.com/questions/35346757/sql-dacpac-deploy-using-sqlpackage-and-dropobjectsnotinsource-with-donotdropuser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!