我有一个设置 Gulp 任务运行程序的项目。在 VS2015 中一切正常,但是当我升级到 VS2017 时,MSBuild 开始失败。
有趣的是,如果我复制显然失败的命令行并将其粘贴到 cmd 中,那么它工作得非常好。
我收到以下错误:
[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!
如果我复制说明为失败的命令行并在 CMD 中运行它,它就可以工作。我已经尝试了以下修复,但没有任何运气。
失败的 gulp 任务如下所示:
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"
}
}));
}));
};
帮助将不胜感激,因为我真的很想使用 VS2017 而不是 2015。