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

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解决了这个问题。但是现在我从头开始安装一个新的服务器,我想知道是否有更好的解决方案来解决这个问题。


当前回答

After installation of MSBuild tools from Microsoft, define the MSBuild path in the environment variable, so that it can be run from any path. Edit the .csproj file in any notepad editor such as notepad++, and comment the Check for the following elements, --> Make sure you use import only once, choose whichever works. Make sure you have the following folder exists on the drive, "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0" or whichever version is referenced by MSBuild target at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" From the command prompt, run the following command, to check

C: > msbuild“C: \ \ DotnetCi。/p:Configuration=Release /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false

根据需要选择/p开关,请参考此处输入链接说明 在这里输入图像描述

其他回答

如上所述,除了针对Microsoft. webapplication .targets的“Microsoft Visual Studio 2010 Shell(集成)可重分发包”和针对Microsoft. data . schema . sqltasks .targets的“Microsoft Visual Studio Team System 2008 Database Edition GDR R2”之外,最新的Windows SDK应该可以减少安装Visual Studio 2010的需求。然而,安装VS 2010可能实际上更少的整体下载和更少的工作。

如果将Visual Studio 2012迁移到2013,则打开*。Csproj项目文件编辑器。 并检查'Project'标签的ToolsVersion元素。

将其值从4.0更改为12.0

从 <?XML版本="1.0"编码="utf-8"?> <Project ToolsVersion="4.0"… 来 <?XML版本="1.0"编码="utf-8"?> <Project ToolsVersion="12.0"…

或者如果你用msbuild构建,那么只需指定VisualStudioVersion属性

msbuild / p: VisualStudioVersion = 12.0

解决方案的来源

After installation of MSBuild tools from Microsoft, define the MSBuild path in the environment variable, so that it can be run from any path. Edit the .csproj file in any notepad editor such as notepad++, and comment the Check for the following elements, --> Make sure you use import only once, choose whichever works. Make sure you have the following folder exists on the drive, "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0" or whichever version is referenced by MSBuild target at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" From the command prompt, run the following command, to check

C: > msbuild“C: \ \ DotnetCi。/p:Configuration=Release /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false

根据需要选择/p开关,请参考此处输入链接说明 在这里输入图像描述

对我来说,它只是一个端口块。

回答问题的标题(而不是你得到的输出的问题):

如果只是web应用程序,将以下文件夹从开发机器复制到构建服务器可以修复此问题

C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio\v10.0\WebApplications

根据构建中断的方式删除x86。如果你有其他项目类型,你可能需要复制整个msbuild文件夹。