Data-Tier Application (dac) and SqlPackage.exe
Can you install tools to export/deploy DacPac files without requiring a Visual Studio installation?
- Prerequisites. Install following from Microsoft SQL Server 2014 Feature Pack https://www.microsoft.com/en-us/download/details.aspx?id=42295
-
- ENU\x64\SqlDom.msi
- ENU\x64\SQLSysClrTypes.msi
- Install Data-Tier Application Framework. (May 2015 version is here: https://www.microsoft.com/en-us/download/details.aspx?id=46898. This took some finding: there was a link to it in the Microsoft SQL Server 2014 Feature Pack Install Instructions section.
- Download and run en-EN\x64\DACFramework.msi (3.5MB)
- Find SqlPackage.exe here C:\Program Files\Microsoft SQL Server\120\DAC\bin
Favourite SqlPackage commands
Command Line reference https://msdn.microsoft.com/en-us/library/hh550080%28v=vs.103%29.aspx
Extract DACPAC | I didn’t find that the /p:IgnoreUserLoginMappings={True | False} switch made any difference. Users were still created on default deployment.
The definition in the reference is not easy to interpret: “Specifies whether relationships between users and logins will be ignored.” Does that mean it will still attempt to create users, or not? |
Deploy DACPAC | “C:\Program Files\Microsoft SQL Server\120\DAC\bin\SQlPackage.exe” /a:publish /tcs:”Data Source=localhost;Initial Catalog=mydb;Integrated Security=true” /sf:”C:\Temp\db_backup\ADatabase.dacpac” /p:ExcludeObjectTypes=RoleMembership;users;Logins; This excludes users and logins, necessary if deploying to environment that doesn’t support users that were in the source. If there are objects owned by a custom user the deployment will still fail. |