Archive

Archive for the ‘.Net Core’ Category

Enabling CI for .net core using TFS Build

October 10, 2016 Leave a comment

At the moment there is no easy way to implement CI for .net core projects. Ideally it should be published and deployed to individual instances of nano servers, but that might be something beyond the capability of TFS Build.

Should you wish to implement CI for .net core projects on TFS 2015, here are the build steps and scripts that you need.

  1. Step 1: Install .net core
    Download https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-install-script and either place it inside TFS or else in a central location. This will install and setup the .net Core CLI Runtime for the service account that is used by the build servers
    image
  2. Step 2: Run dotnet restore and dotnet publish
    Download and modify the powershell script found at http://pastebin.com/yyjbGDW9. It assumes that each folder is an individual .net core project that needs to be published. Modify accordingly to your environment

    It is important to add in the OutputDir argument as that defines where the published project goes
    image

    As this builds all the projects, you may also want to check “Continue on error”
    image

  3. Step 3: Deploy to the servers
    You can find the script I use at http://pastebin.com/8jBHz3Zf. Important thing to note is that you need to first stop IIS on the target server before copying the files over as running net core on IIS locks the dll files
    image