Gulp Task Runner MSBuild失败,但在CMD中起作用



i有一个项目,其中墨西哥大师的任务跑步者正在设置。在VS2015中,一切正常都很好,但是当我升级到VS2017 MSBuild开始失败时。

有趣的是,如果我复制显然失败并将其粘贴到CMD中的命令行,那么它的工作原理很好。

我有以下错误:

[09:47:27] Building project: ..DFS.ClientDFS.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)MSBuild14.0BinMSBuild.exe" 
"C:solutionsdfscodeDFS.ClientDFS.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:inetpubwwwrootdfsdevWebsite" 
/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年。

将不胜感激。

工具版本14.0用于VS2015,工具15.0适用于VS2017。您可能还需要更改其他一些配置才能启用它。希望会有所帮助。

相关内容

最新更新