升级到 Visual Studio 2013 后,由于缺少 SqlServer.targets 文件,项目无法加载

升级到 Visual Studio 2013 后,我发现在尝试打开解决方案时无法加载旧的 SQL 项目.显示的错误是:

Having upgraded to Visual Studio 2013, I have found that an old SQL project fails to load when I attempt to open a solution. The error displayed is:

未找到导入的项目C:Program Files (x86)MSBuild12.0inSqlServer.targets".确认声明中的路径正确,并且该文件存在于磁盘上.C:SomePathToProjectDatabase.sqlproj

The imported project "C:Program Files (x86)MSBuild12.0inSqlServer.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:SomePathToProjectDatabase.sqlproj

在我的 .sqlproj 文件中,我有一行

In my .sqlproj file I have the line

<Import Project="$(MSBuildToolsPath)SqlServer.targets" />

在 Visual Studio 2012 中解析为 C:WindowsMicrosoft.NETFrameworkv4.0.30319SqlServer.targets 但在 Visual Studio 2013 中解析为 C:Program文件 (x86)MSBuild12.0inSqlServer.targets.但是,SqlServer.targets 文件不在这些位置.

which in Visual Studio 2012 resolves to C:WindowsMicrosoft.NETFrameworkv4.0.30319SqlServer.targets but in Visual Studio 2013 this resolves to C:Program Files (x86)MSBuild12.0inSqlServer.targets. However, the SqlServer.targets file is in neither of these locations.

这可能是因为 MSBuild 成为 Visual Studio 的一部分,而不是它成为 .Net Framework 的一部分.

Presumably this is due to MSBuild becoming part of Visual Studio, rather than it being part of the .Net Framework.

有谁知道如何解决这个问题并将这个项目迁移到 Visual Studio 2013?

Does anyone know how to fix this issue and to migrate this project to Visual Studio 2013?

推荐答案

我在VS 2013下尝试构建VS 2010解决方案时遇到了同样的问题.解决方法是先将解决方案文件升级到VS 2013.之后,它无需进一步修改即可工作.

I had the same problem when trying to build a VS 2010 solution under VS 2013. The fix was to upgrade the solution file to VS 2013 first. After that it worked without further modifications.

相关文章