为什么SqlPublish目标对于SQL Server 2014数据库项目失败? [英] Why does the SqlPublish target fail for a SQL Server 2014 database project?

查看:173
本文介绍了为什么SqlPublish目标对于SQL Server 2014数据库项目失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器具有当前(2014年3月)的SSDT版本,Visual Studio 2012 Professional和SQL Server 2014 Developer.我有一个针对SQL Server 2014的SQL Server项目(简称为MyProject.sqlproj).我尝试了以下操作:

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 72002:内部错误.
具有类型的数据库平台服务 Microsoft.Data.Tools.Schema.Sql.Sql120DatabaseSchemaProvider不是 有效的.您必须确保服务已加载,或者您必须提供 有效的数据库平台服务的完整类型名称.

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.

如果我将此项目切换到目标2012(并指向2012实例),则该命令将成功运行.我之前曾问过一个可能相关的问题,然后那里的答案解决了我的问题,但这不是这里的问题-如果直接使用SqlPackage.exe,则可以成功发布此2014 DACPAC.

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?

推荐答案

此处的问题是未设置VisualStudioVersion环境变量,在这种情况下,.sqlproj文件当前默认针对VS2010版本(不支持VS2010版本). SQL Server 2014).在运行MSBuild之前调用"set VisualStudioVersion = 11.0"将解决此问题.

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.

这篇关于为什么SqlPublish目标对于SQL Server 2014数据库项目失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆