I have a project where Gulp task runner is setup. Everything works perfectly fine in VS2015, but when I upgraded to VS2017 MSBuild started to fail.
The funny thing is, that if I copy out the command line that apparently fails and paste it into the cmd, then it works perfectly fine.
I get the following error:
[09:47:27] Building project: ..\DFS.Client\DFS.Client.csproj
[09:47:27] Using automatic maxcpucount
[09:47:27] Building project: 1 item
[09:47:27] { Error: Command failed: "C:\Program Files
(x86)\MSBuild\14.0\Bin\MSBuild.exe"
"C:\solutions\dfs\code\DFS.Client\DFS.Client.csproj" "/target:Clean;Build"
/verbosity:minimal /toolsversion:14.0 /nologo /maxcpucount
/property:Configuration="Debug" /property:DeployOnBuild="true"
/property:DeployDefaultTarget="WebPublish"
/property:WebPublishMethod="FileSystem"
/property:DeleteExistingFiles="false"
/property:publishUrl="C:\inetpub\wwwroot\dfsdev\Website"
/property:_FindDependencies="true"
at ChildProcess.exithandler (child_process.js:204:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:891:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
killed: false,
code: 1,
signal: null,
cmd: '"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe"
"C:\\solutions\\dfs\\code\\DFS.Client\\DFS.Client.csproj"
"/target:Clean;Build" /verbosity:minimal /toolsversion:14.0 /nologo
/maxcpucount /property:Configuration="Debug" /property:DeployOnBuild="true"
/property:DeployDefaultTarget="WebPublish"
/property:WebPublishMethod="FileSystem"
/property:DeleteExistingFiles="false"
/property:publishUrl="C:\\inetpub\\wwwroot\\dfsdev\\Website"
/property:_FindDependencies="true"' }
[09:47:27] Build failed!
If I copy the command line that is stated as failing and run it in CMD it works. I have tried the following fix without any luck.
The gulp task that fails looks like this:
var publishProjects = function (location, dest) {
dest = dest || config.websiteRoot;
var targets = ["Build"];
if (config.runCleanBuilds) {
targets = ["Clean", "Build"];
}
console.log("publish to " + dest + " folder");
return gulp.src([location + "/**/*.csproj"])
.pipe(foreach(function (stream, file) {
return stream
.pipe(debug({ title: "Building project:" }))
.pipe(msbuild({
targets: targets,
configuration: config.buildConfiguration,
logCommand: false,
verbosity: "minimal",
maxcpucount: 0,
toolsVersion: 14.0,
properties: {
DeployOnBuild: "true",
DeployDefaultTarget: "WebPublish",
WebPublishMethod: "FileSystem",
DeleteExistingFiles: "false",
publishUrl: dest,
_FindDependencies: "true"
}
}));
}));
};
Help would be appreciated as I would really like to use VS2017 rather than 2015.