试图在构建服务器上构建我的项目给我以下错误:
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解决了这个问题。但是现在我从头开始安装一个新的服务器,我想知道是否有更好的解决方案来解决这个问题。
我的解决方案是这里几个答案的混合。
我检查了构建服务器,Windows7/NET4.0 SDK已经安装,所以我确实找到了路径:
C:\Program Files (x86)\MSBuild\Microsoft\ VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets
但是,在这一行:
<进口项目=”(MSBuildExtensionsPath美元)\ Microsoft \ VisualStudio v9 WebApplication 0 WebApplications \ Microsoft。很明显" - >
$(MSBuildExtensionsPath)扩展到C:\Program Files\MSBuild,其中没有路径。
因此,我所做的就是创建一个符号链接,使用下面的命令:
mklink /J "C:\Program Files\MSBuild\Microsoft\VisualStudio" "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio"
通过这种方式,$(MSBuildExtensionsPath)扩展到一个有效的路径,应用程序本身不需要更改,只需要在构建服务器中更改(也许可以在每个构建中创建符号链接,以确保这一步不会丢失并被“记录”)。
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开关,请参考此处输入链接说明
在这里输入图像描述