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

喜你入骨 提交于 2019-12-01 21:44:52

问题


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:


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.



来源:https://stackoverflow.com/questions/24334802/why-does-the-sqlpublish-target-fail-for-a-sql-server-2014-database-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!