Hungry Beast
Hungry Beast

Reputation: 3735

SQL Dacpac Deploy using SqlPackage and DropObjectsNotInSource with DoNotDropUsers

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?

Upvotes: 5

Views: 3649

Answers (2)

Derek Evermore
Derek Evermore

Reputation: 1418

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

Upvotes: 1

Steven Green
Steven Green

Reputation: 3517

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

Upvotes: 3

Related Questions