5
votes

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?

1
Are you running MSBuild from the VS2012 developer command prompt, or from a regular command prompt / some other environment? Also do you have VS2010 installed on your machine? The most likely cause is that the VisualStudioVersion environment variable isn't set, in which case the .sqlproj file currently defaults to targeting the VS2010 version. Try calling "set VisualStudioVersion=11.0" before running MSBuild and see if this fixes the issue.Kevin Cunnane
Aha! Yes, I do have VS 2010 installed, and was running it from a regular command prompt. Calling "set VisualStudioVersion=11.0" before executing it worked!Nick Jones
Great, problem solved :)Kevin Cunnane
Thanks @KevinCunnane -- if you want to add this as an answer, I'll happily accept it.Nick Jones

1 Answers

4
votes

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.