Release Management – Exception with DACPAC deploy tool

Issue

Exception stack when trying to deploy a dacpac package using an agent based release template, using DACPAC tool

*** Could not deploy package.
Unable to connect to target server.

Environment

· Release Management Server 2013 above
· Agent based deployment using inbuilt DACPAC database deployer to deploy DACPAC packages

Cause

Release Management tool has an in-built tool for helping DACPAC deployment. This tool has a copy of SQLPackage.exe attached to it. This belongs to SQL 2008 R2 (version 10.0). If you are using this deployer tool, the supporting assemblies and the executable are copied to the working folder of RM (C:\Users\<RM Agent account>\AppData\Local\Temp\Relaease Management\) and the SQLPackage command is executed from this folder.

clip_image003

If you are deploying to a higher version of SQL – say 2012, the command would fail as the tool has copied libraries that belong to older version.

Resolution

Since a single tool can’t be used for all versions of SQL, we may have to create one that suits us.
You can create a new tool for SQL 2012, with similar arguments as the existing tool but with the SQLPackage.exe and the supporting assemblies take from SQL 2012.

· Create a new tool, sat DACPAC 2012
· Command would be - sqlpackage.exe
· Arguments would be - /Action:Publish /SourceFile:__FileName__ /TargetDatabaseName:__DatabaseName__ /TargetServerName:__ServerName__

clip_image005

· Click on Add and go to this path - C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin. The hive 110 corresponds to SQL 2012. Use the hive that corresponds to the version you want to release to.

· Add the SQLPackage.exe and the three supporting assemblies

o Microsoft.Data.Tools.Schema.Sql
o Microsoft.Data.Tools.Utilities
o Microsoft.SqlServer.Dac

clip_image007

You are good to use this tool to deploy to a SQL 2012 server.

Content created by – Venkata Narasimhan
Content reviewed by – Romit Gulati