To build ASP.NET Core 1.0 with Team foundation 2013.4 XAML builds, following steps should be done.
Prepare the build server
1. Install VS 2015 in the build server
2. Install below by login to the build server as build service user (tfsbuildsvc in this case). Install chocolatey in build server (its easy to do other installations when chocolatey is installed.)
- To install chocolatey run below command in PS window(run as administrator)
- install nodejs with below command
- Change directory to nodejs install path (C:\Program Files\nodejs)
- Install bower and gulp for global use using below commands
npm install bower -g
npm install gulp -g
Build Scripts – Pre Build
Pre build script to set dnx is required. use below script.
Make sure to add global.json file to the location of the solution file and check it in to version control.
Global.json content below specifying version globally.
Build Scripts – Post Build Publish Script
In publish script environment variable settings to path should be added with below. This will allow to run PrePublish script specified in project.json
$env:Path += ";C:\Program Files\nodejs;C:\Users\tfsbuildsvc\AppData\Roaming\npm"
Set Build definition to Run Build scripts
In build definition set to execute scripts as shown below. Set tool version in build definition to use VS 2015 tools. /tv:14
RunPreBuildScript and RunPostBuildScript are used since there could be more scripts that need to be executed and only one is allowed in XAML build definition. These script could invoke other scripts.
You could run into
npm WARN deprecated email@example.com: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated firstname.lastname@example.org: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated email@example.com: this package has been reintegrated into npm and is now out of date with respect to npm
npm ERR! cb() never called!
npm ERR! not ok code 0
This is discussed in here. To disable this warning raising as an error change the project.json prepublish script section as below (Add --loglevel=error to npm install).
You can get a successful build with TFS build 2013.4, for ASP.NET Core 1.0.