Habitat Gulp build script is using gulp-msbuild plugin to create the msbuild cmd. Behind the scene, if you look within gulp-msbuild in your node-modules or in the official repos here, you can find the msbuild-finder code where you will also find hardcoded path to where it looks for msbuild (C:/)
// Line 247,
let pathRoot = process.env["ProgramFiles"] || "C:/Program Files";
if (hostIs64Bit) {
pathRoot = process.env["ProgramFiles(x86)"] || "C:/Program Files (x86)";
}
let msbuildRoot = pathRoot;
let toolsVersion = parseFloat(options.toolsVersion);
// ...
So you could console.log() within that file and have a better understanding of what is happening.
Also note that this plugin was blacklisted in the official gulp plugin directory. Can use the msbuild plugin instead which would lead you to the exact same issue because it is also looking at C:/ by default. You can define what msbuild version to use with the version switch, but would only lead to the local path to msbuild within the C: drive.
Side note : I think it is more flexible to create an msbuild cmd and easier since you can add any of the offical msbuild switch (doc here) as an override param. Could end up with something similar to
var overrideParams = [];
overrideParams.push(`/t:${targets}`,
`/v:${config.solution.buildVerbosity}`,
'/nologo',
`/m:${config.solution.buildMaxCpuCount}`,
'/nr:False',
`/p:Configuration=${config.solution.buildConfiguration}`,
`/p:Platform=${config.solution.buildPlatform}`,
'/p:DeployOnBuild=true',
'/p:DeployDefaultTarget=WebPublish',
'/p:WebPublishMethod=FileSystem',
'/p:DeleteExistingFiles=false',
`/p:publishUrl=${dest}`,
'/p:_FindDependencies=true');
msbuild.sourcePath = filePath;
msbuild.config('overrideParams', overrideParams);
msbuild.version = `${config.solution.buildToolsVersion}`;
msbuild.build();
So long story short, Gulp's msbuild plugins are not taking into consideration VStudio being installed anywhere but on C: drive.