试图在构建服务器上构建我的项目给我以下错误:

Microsoft (R) Build Engine Version 4.0.30319.1
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

几个月前,我通过在Build Server上安装Visual Studio 2010解决了这个问题。但是现在我从头开始安装一个新的服务器,我想知道是否有更好的解决方案来解决这个问题。


当前回答

来这里参加Visual Studio 2017的人。我也有类似的问题,更新到15.6.1后无法编译项目。 我不得不安装MSBulild工具,但错误仍然存在。

通过将v14.0文件夹从C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio复制到与v15.0相同的文件夹,我能够解决这个问题,这解决了所有错误。 现在我的文件夹结构如下所示,其中两个文件夹包含相同的内容。

其他回答

你也可以使用NuGet包MSBuild.Microsoft.VisualStudio.Web。目标,在你的Visual Studio项目中引用它们,然后按照Andriy K的建议更改你的引用。

我通过在docker容器中运行构建来解决这个问题,特别是dotnet/framework/sdk。它包括VS构建工具。

我在MS connect上找到了这个:

是的,您需要安装Visual Studio 2010在你的构建机器上进行构建 数据库项目。这样做确实 不需要额外的许可证 Visual Studio。

所以,这是我目前唯一的选择。

如果没有安装VS,则不支持构建和发布wap。也就是说,如果你真的不想安装VS,那么你需要复制%ProgramFiles32%\MSBuild\Microsoft\下的所有文件。

您还需要安装Web部署工具。我想就是这样了。

来这里参加Visual Studio 2017的人。我也有类似的问题,更新到15.6.1后无法编译项目。 我不得不安装MSBulild工具,但错误仍然存在。

通过将v14.0文件夹从C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio复制到与v15.0相同的文件夹,我能够解决这个问题,这解决了所有错误。 现在我的文件夹结构如下所示,其中两个文件夹包含相同的内容。