我决定看看专业的sitecore 8开发bak,我在第4章结束时遇到问题,当时作者解释了如何为构建设置gulp - 我对此没有任何经验工具。
与指南相比,我必须修改gulpfile.js上的一些路径,因为例程没有找到csproj文件 - 我注意到在文件系统上解决方案不是进入文件夹(正如我在预期的解决方案中所预期的那样)。 现在我可以从我的VS2017运行任务,但任务返回错误" MSBuild失败,代码为1!"。
编辑:我设法在此链接后取得了一些进展:https://sitecore.stackexchange.com/questions/5344/when-using-gulp-to-build-a-helix-based-solution-what-does-msbuild-failed-with
我的配置现在如下所示:
/// <binding />
var gulp = require("gulp");
var msbuild = require("gulp-msbuild");
var debug = require("gulp-debug");
var foreach = require("gulp-foreach");
var gulpConfig = require("./gulp-config.js")();
module.exports.config = gulpConfig;
gulp.task("Publish-Site", function () {
return gulp.src("./**/*.csproj")
.pipe(foreach(function (stream, file) {
return stream
.pipe(debug({ title: "Publishing " }))
.pipe(msbuild({
targets: ["Build"],
gulpConfiguration: gulpConfig.buildConfiguration,
properties: {
publishUrl: gulpConfig.webRoot,
DeployDefaultTarget: gulpConfig.webRoot,
WebPublishMethod: "FileSystem",
DeployOnBuild: "true",
DeleteExistingFiles: "false",
_FindDependencies: "false",
VisualStudioVersion: "15.0"
},
verbosity: "diagnostic",
toolsVersion: 15.0
}));
}));
});
但是现在当我尝试运行任务时,收到错误:
\SitecoreDev\Gulpfile.js" Publish-Site [16:28:54] Using gulpfile C:\VSTS\Sitecore8Dev\SitecoreDev\Gulpfile.js [16:28:54] Starting 'Publish-Site'... [16:28:55] Publishing SitecoreDev\SitecoreDev.csproj [16:28:55] Publishing 1 item [16:28:55] { Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin\\MSBuild.exe', path: 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin\\MSBuild.exe', spawnargs: [ 'C:\\VSTS\\Sitecore8Dev\\SitecoreDev\\SitecoreDev\\SitecoreDev.csproj',
'/target:Build',
'/verbosity:diagnostic',
'/toolsversion:15.0',
'/nologo',
'/maxcpucount',
'/property:Configuration=Release',
'/property:publishUrl=C:\\Websites',
'/property:DeployDefaultTarget=C:\\Websites\\',
'/property:WebPublishMethod=FileSystem',
'/property:DeployOnBuild=true',
'/property:DeleteExistingFiles=false',
'/property:_FindDependencies=false',
'/property:VisualStudioVersion=15.0' ] } [16:28:55] MSBuild failed! [16:28:55] MSBuild failed with code -4058! [16:28:55] 'Publish-Site' errored after 1.26 s error! [16:28:55] Error: no writecb in Transform class
at afterTransform (C:\VSTS\Sitecore8Dev\SitecoreDev\node_modules\gulp-foreach\node_modules\readable-stream\lib\_stream_transform.js:95:33)
at TransformState.afterTransform (C:\VSTS\Sitecore8Dev\SitecoreDev\node_modules\gulp-foreach\node_modules\readable-stream\lib\_stream_transform.js:79:12)
at DestroyableTransform.<anonymous> (C:\VSTS\Sitecore8Dev\SitecoreDev\node_modules\gulp-foreach\index.js:60:9)
at emitNone (events.js:105:13)
at DestroyableTransform.emit (events.js:207:7)
at C:\VSTS\Sitecore8Dev\SitecoreDev\node_modules\gulp-msbuild\index.js:25:12
at ChildProcess.<anonymous> (C:\VSTS\Sitecore8Dev\SitecoreDev\node_modules\gulp-msbuild\lib\msbuild-runner.js:57:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:927:16) Process terminated with code 1.