Deploy DacPac to SQL Server 2017 using WebDeploy/MSDeploy.exe

I’ve used WebDeploy/MSDeploy for many years to automate the deployment of almost everything I build. This week I hit an issue in our automated release pipeline where the deployment of SQL database failed with following errors (each from a different build agent):

Error Code: ERROR_EXECUTING_METHOD
More Information: Could not deploy package.
Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.Sql140DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service.
   Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.

Error Code: ERROR_EXECUTING_METHOD
More Information: Could not read schema model header information from package.
The model version ‘2.9’ is not supported.
   Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.

After some initial research of these errors it became clear the problem was I was trying to deploy SQL Server 2017 which I had never done in my automated build/deployment pipeline.

I started with updates to all the Visual Studio components via the installer but no luck:

image

Next I tried installed the latest DacPac Framework tools but still no dice.

So I went back to my local development machine to verify it worked from there and mimicked the same deployment command from the command line and it worked.  What!?

The Solution

Have racking my brain for several hours I found a blog post that mentioned installing SQL Server fixed a similar issue for another developer.  So I installed SSMS:

https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017

image

And it worked!  I really don’t like installing software on my build agents but I like using the latest version of SQL Server more in this case.  Eventually Microsoft will include the necessary 2017-compatible DacPac framework DLLs with WebDeploy or even better in a nuget package.  Until then you can use this workaround.

If this post helped you fix the same error, please let me know in the comments below.

Happy Deploying!

Leave a Reply