Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the SqlPublish target fail for a SQL Server 2014 database project?

My machine has the current (March 2014) version of SSDT, Visual Studio 2012 Professional, and SQL Server 2014 Developer. I have a SQL Server project (let's call it MyProject.sqlproj) that targets SQL Server 2014. I attempted the following:

MsBuild.exe MyProject.sqlproj 
            /t:SqlPublish /p:SqlPublishProfilePath=Somewhere.publish.xml

This fails with the following error:

Deploy error Deploy 72002: Internal Error.
The database platform service with type Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider 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.

If I switch this project to target 2012 (and point to a 2012 instance), this same command runs successfully. I had previously asked a potentially related question, and the answer there resolved my problem then, but that's not the issue here -- I'm able to publish this 2014 DACPAC successfully if I use SqlPackage.exe directly.

What's happening, and how can I fix it?

like image 610
Nick Jones Avatar asked Sep 30 '22 12:09

Nick Jones


1 Answers

The issue here is that the VisualStudioVersion environment variable isn't set, in which case the .sqlproj file currently defaults to targeting the VS2010 version (which does not support SQL Server 2014). Calling "set VisualStudioVersion=11.0" before running MSBuild will fix the issue.

like image 182
Kevin Cunnane Avatar answered Oct 20 '22 06:10

Kevin Cunnane