.net-corebuildtfs-2017

TFS 2017 Deploy ASP .NET Core


We are on TFS 2017 initial release (on premise install). I am looking to see how I can build ASP .NET Core 2.0 apps using TFS 2017 Build / Release. Right now our standard builds uses Visual Studio builds and we have visual studio 2015 installed on our build server.

When I am attempting to build ASP .NET core 2 MVC app, using Visual Studio build, the build is failing with an error message :

Trunk\xxxxxx.csproj (1, 1) Trunk\xxxxxx.csproj(1,1): Error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

Can I ask what is the recommended approach to building / deploying .NET core 2.0 projects using TFS 2017?

  1. Install VS 2017 on the build server? We already have VS 2015 installed on the build server. Can VS 2015 and VS2017 live side by side on the build server and will the VS build step pick up 2017? Visual Studio Builld

  2. Or should we be installing .NET core 2.0 SDK on the build server and then use command line utility as a part of the build step.

  3. Or should we switiching to MSBUILD instead of VS studio build and installing just the MSBuild for VS 2017 on the builld server.


Solution

  • 1.You could install VS2017 on the build server. VS2017 and VS2015 could live side by side on either a build server or a develop machine. You just need to select which version you will use in visual studio version picklist. However VS2017 option is not support on the build-in Visual Studio Build task on TFS2017. It's not related to VS2017 installed on the build server or not.

    2.You need to install .NET CORE 2.0 SDK on the build server, otherwise will get a similar error as below:

    error : The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK.

    Highly recommend you to keep the build server environment as same as local develop machine, this will narrow down the build issue on TFS.

    3.No you don't have to. Just follow the process in this tutorial-- Build your ASP.NET Core app

    Suggest you update your TFS 2017 initial release to the latest version TFS2017 update2. This will include VS2017 in the picklist of vs version. And since .NetCore 2.0 released in May 2017 which is later then the initial TFS2017(November 2016), not sure if it's supported or have any other issues. However, one thing is certain: you could build .NET Core 2.0 apps in TFS2017update2 successfully. Moreover, there are many new features released with update2 version, there is no reason to stay on the initial TFS2017.

    enter image description here