Alright, so I have continue integration for my new dotnet core applications. Building works great. It's now time to publish. I'm using gulp on my pre-publish commands to move files, compile typescripts, minify css/javascripts, etc. It works fine for my user after running npm install gulp -g. But, because I want all of my publish and builds to be self contained, and it also doesn't work when running under my build user spitting out an error saying Error : 'gulp' is not recognized as an internal or external command I needed to fix it. It turns out that it's pretty easy once you find the right commands anyways.

In package.json, make sure you have "scripts":{"gulp":"gulp"} in there. Now, in project.json, where you run your gulp commands, which is probably something along the lines of gulp taskname change it to use npm run-script gulp taskname. And now you will use the local install of gulp (under node_modules\.bin) rather than maintaining a global install of gulp across all of your build servers. Here is the resulting changes to the config files. On a side note, npm and node must be installed on the server for this to work.

  // project.json/scripts section
  "scripts": {
    "prepublish": [ "npm install", "npm run-script gulp clean", "npm run-script gulp tsbuild", "npm run-script gulp less", "npm run-script gulp min", "npm run-script gulp copy-npm" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]

  // package.json
  "devDependencies": {
    "gulp": "3.8.11",
    "gulp-concat": "2.5.2",
    "gulp-cssmin": "0.1.7",
    "gulp-less": "3.0.5",
    "gulp-rename": "1.2.2",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "1.2.0",
    "gulp-util": "3.0.7",
    "gulp-tsd": "0.0.4",
    "gulp-typescript": "^2.13.6",
    "rimraf": "2.2.8",
    "tsd": "0.6.5"