Archive

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.

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

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

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

AddTransient: It will create a new instance each time it is accessed. e.g when I call it from the MVC Controller and from frontend MVC code, I will get 2 independent instances

AddScoped: It will create a new instance for the particular request, e.g when I call it from MVC Controller and frontend MVC Code, it’s the same instance. However it does not survive across different OWIN middleware

AddSingleton: Creates a single instance for all requests

AddInstance: Creates a single instance for all requests, but the constructor is left to the developer