在构建服务器上找不到Microsoft.WebApplication.你的解决方案是什么?

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


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


守着一只汪
浏览 1597回答 3
3回答

catspeake

要回答问题的标题(但不是关于你得到的输出的问题):将以下文件夹从您的开发计算机复制到您的构建服务器,如果它只是Web应用程序,则会修复此问题C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ WebApplications根据构建中断的方式删除x86。如果您有其他项目类型,则可能需要复制整个msbuild文件夹。

郎朗坤

如果未安装VS,则不支持构建和发布WAP。话虽如此,如果你真的不想安装VS那么你需要复制下的所有文件%ProgramFiles32%\MSBuild\Microsoft\。您还需要安装Web Deploy Tool。我想就是这样。

慕盖茨4494581

UPD:从VS2017开始,Build Tools中的工作负载完全消除了这个问题。请参阅@SOReader答案。如果您不想在构建服务器上修改任何内容,并且仍希望项目能够直接从源代码控制中构建,那么将所需的二进制文件置于源代码管理之下可能是个好主意。您需要修改项目文件中的imports部分,如下所示:<Import Project="$(SolutionDir)\BuildTargets\WebApplications\Microsoft.WebApplication.targets" /><Import Condition="false" Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />第一行是相对于解决方案目录的新位置的实际导入。第二个是Condition="false"原始行的关闭版本(),允许Visual Studio仍将您的项目视为有效的Web应用程序项目(这是VS 2010 SP1自身的技巧)。不要忘记复制源代码管理下的C:\Program Files (x86)\Microsoft\VisualStudio\v10.0\WebApplicationsto BuildTargets文件夹。
打开App,查看更多内容
随时随地看视频慕课网APP