简体   繁体   English

使用TFS 2012构建服务器构建VS2017项目

[英]Build VS2017 project with TFS 2012 build server

We have an on-premise TFS 2012 server and build server. 我们有一个内部部署的TFS 2012服务器和构建服务器。 We are in the process of upgrading to VS and TFS 2017. At the moment, there is the request to set up another build server that will allow us to build new 2017 projects from the existing TFS server. 我们正在升级到VS和TFS 2017.目前,有人要求设置另一个构建服务器,以便我们从现有的TFS服务器构建新的2017项目。 I create a new build server and installed TFS 2012 build services on it as well as VS2017. 我创建了一个新的构建服务器并在其上安装了TFS 2012构建服务以及VS2017。 I created a new build definition but it fails to compile and errors show things like the syntax changes for 2017 that are invalid in 2012. How do I tell configure this to build the project against the installed VS2017? 我创建了一个新的构建定义,但它无法编译,错误显示2017年的语法更改在2012年无效。我如何告诉configure这个针对已安装的VS2017构建项目?

Thanks to this post, I was able to use TFS 2012 continuous integration with build server building C# 6 syntax using Visual studio 2017. Hopefully this will save the next person some time in trying to figure this out. 感谢这篇文章,我能够使用TFS 2012与使用Visual Studio 2017构建C#6语法的构建服务器持续集成。希望这将为下一个人节省一些时间来试图解决这个问题。

Here are the list of things I have changed in order to get TFS 2012 to build c# 6 syntax. 以下是为了让TFS 2012构建c#6语法而更改的列表。 On the machine with the build agent, install vs 2017 enterprise, on the installation setup page, make sure MS build is selected 在具有构建代理的计算机上,安装vs 2017 enterprise,在安装设置页面上,确保选择了MS build 在此输入图像描述

Edit the Build definition and make sure the MSBuild Argument is /tv:15.0 /p:GenerateBuildInfoConfigFile=false /p:VisualStudioVersion=15.0 编辑Build定义并确保MSBuild Argument为/tv:15.0 /p:GenerateBuildInfoConfigFile=false /p:VisualStudioVersion=15.0

在此输入图像描述

Check the template your build definition is using and modify it by going to the source control explorer and going into the team project and undert BuildProcessTemplate, it should have the .xaml file, modify it by double clicking on it 检查构建定义正在使用的模板,并通过转到源代码管理资源管理器并进入团队项目并进行BuildProcessTemplate来修改它,它应该有.xaml文件,通过双击它来修改它 在此输入图像描述

There should be 2 actions that say Run MSBuild for Project. 应该有2个操作说运行MSBuild for Project。 You need to change both of their toolpath property to point to the msbuild.exe parent folder on the build server. 您需要将其toolpath属性更改为指向构建服务器上的msbuild.exe父文件夹。 In my case, the build server is a 32 bit machine so the path to the Bin folder doesn't have (x86) next to Program Files, you need to check your build server to enter the correct path here. 在我的例子中,构建服务器是32位机器,因此Bin文件夹的路径没有Program Files旁边的(x86),您需要检查构建服务器以在此处输入正确的路径。 在此输入图像描述 After you have made the changes, you need to save the xaml and check it in. 完成更改后,您需要保存xaml并将其签入。

Old Visual Studio versions installed msbuild into C:\\Program Files (x86)\\MSBuild\\<version>\\bin and apparently the RunMSBuild activity used the ToolVersion + the ToolArchitecture to calculate this path. 旧的Visual Studio版本将msbuild安装到C:\\Program Files (x86)\\MSBuild\\<version>\\bin ,显然RunMSBuild活动使用ToolVersion + ToolArchitecture来计算此路径。

VS 2017 instead installs it C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\15.0\\bin and the RunMSBuild can't calculate the proper path anymore. VS 2017安装它C:\\ Program Files(x86)\\ Microsoft Visual Studio \\ 2017 \\ Enterprise \\ MSBuild \\ 15.0 \\ bin并且RunMSBuild无法再计算正确的路径。 You can not use the old DefaultTemplate11.1xaml to integrate with VS2017. 您不能使用旧的DefaultTemplate11.1xaml与VS2017集成。

To make this work, you could try to modify the TFSBuildServiceHost.exe.config and you must have a version of VS 2013 or VS 2015 installed on the build server in order for this to work. 要使其工作,您可以尝试修改TFSBuildServiceHost.exe.config并且必须在构建服务器上安装VS 2013或VS 2015的版本才能使其正常工作。 More detail step please follow Jonesy2488's answer in this link: How to get VS 2017 working with TFS 2017 XAML Builds 更多细节步骤请在此链接中关注Jonesy2488的答案: 如何让VS 2017使用TFS 2017 XAML Builds


Moreover, XAML Build are deprecated in TFS 2017 and will not be available in tge next version of TFS(2018). 此外,XAML Build在TFS 2017中已弃用,并且不会在TFS下一版本的TFS(2018)中提供。 VSTS already no longer supports them. VSTS已经不再支持它们了。

I'm looking for the hosted XAML build controller. 我正在寻找托管的XAML构建控制器。 Where did it go? 它去了哪里?

The hosted XAML build controller is no longer supported. 不再支持托管的XAML构建控制器。 Accounts created on or after April 2016 do not have access to it. 2016年4月或之后创建的帐户无权访问。 We plan to remove the hosted XAML build controller from all accounts, possibly as soon as March 2017. 我们计划在2017年3月之前从所有帐户中删除托管的XAML构建控制器。

Source 资源

Since you are going to upgrade and use TFS2017. 因为您要升级并使用TFS2017。 Highly recommend you to convert your builds to vNext Build to access some new technology and support. 强烈建议您将构建转换为vNext Build以访问一些新技术和支持。 For more please refer Why Should I Leave XAML Builds? 有关更多信息,请参阅我为什么要保留XAML构建?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM