在仅使用 VS2013 的 TFS 构建服务器上构建 VS2013 [英] Build VS2013 on a TFS Build Server With Only VS2013

查看:44
本文介绍了在仅使用 VS2013 的 TFS 构建服务器上构建 VS2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个新的构建服务器来支持我们的开发团队从 VS2010 迁移到 VS2013.我们还没有迁移我们的 TFS 服务器,因此新的构建服务器已设置为具有 2 个代理的 VS2010 构建控制器.我也在机器上安装了VS2013(大锤方法).

I'm setting up a new build server to support a migration of our development team from VS2010 to VS2013. We are not migrating our TFS server just yet so the new build server has been set up as a VS2010 Build Controller with 2 Agents. I have also installed VS2013 on the machine (sledge hammer approach).

我们所有的代码都已迁移到目标 .Net 4.5.1,并且可以在开发人员的工作站上正常编译.

All our code has been migrated to target .Net 4.5.1 and compiles fine on a developer's workstation.

我们的大多数解决方案构建良好,除了包含 Web 项目的解决方案.这些项目都在抱怨:

Most of our solutions build fine, except the solution that contains web projects. These projects are complaining:

未找到导入的项目C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets".

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" was not found.

导入的项目通过这两行在构建过程中使用了VisualStudioVersion变量:

The imported project is using the VisualStudioVersion variable in the build process through these two lines:

<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
...
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

根据这个页面:

http://msdn.microsoft.com/en-us/library/vstudio/bb383796.aspx

对于 4.5 和 4.5.1 目标都将设置为11.0".但是build机只有上面路径的12.0版本:

will be set to "11.0" for both 4.5 and 4.5.1 targets. But the build machine only has a 12.0 version of the above path:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets"

"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets"

这些相同的 .csproj 行似乎在全新的 VS2013 项目中使用,所以我不确定如何在构建机器上正确解决.

These same .csproj lines seem to be used in a brand new VS2013 project so I'm not sure how this could ever resolve correctly on a build machine.

推荐答案

是由于vs2012在csproj文件中加入了这部分:

It is due to Vs2012 adding in csproj file this part:

  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>

您可以安全地移除该部分,您的解决方案就会构建.

You can safely remove that part and your solution will build.

您必须确保 .proj 文件以 <Project ToolsVersion="12" 开头,否则下次使用 Visual Studio 2010 打开项目时,它会再次添加已删除的节点.

You have to ensure that the .proj file begin with <Project ToolsVersion="12" otherwise the next time you open the project with visual studio 2010, it will add the removed node again.

否则,如果您需要使用 webdeploy 或使用构建服务器,上述解决方案将不起作用,但您可以在构建脚本中指定 VisualStudioVersion 属性:

otherwise if you need to use webdeploy or you use a build server the above solution will not work but you can specify the VisualStudioVersion property in your build script:

msbuild myproject.csproj /p:VisualStudioVersion=12.0

或编辑您的构建定义:

这篇关于在仅使用 VS2013 的 TFS 构建服务器上构建 VS2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆