Task with 'gulp-msbuild' finishes prematurely when working with multiple project files
Closed this issue ยท 2 comments
AndreyBelym commented
Hello! I have the following code in my Gulpfile.js
:
gulp.task('clean-win-bin', function (cb) {
del('bin/win', cb);
});
gulp.task('build-win-executables', ['clean-win-bin'], function () {
return gulp
.src('src/natives/**/*.csproj')
.pipe(msbuild({
targets: ['Clean', 'Build'],
errorOnFail: true
}));
});
gulp.task('copy-win-executables', ['build-win-executables'], function () {
return gulp
.src([
'src/natives/**/win/bin/Release/*.exe',
'src/natives/**/win/bin/Release/*.config'
])
.pipe(flatten())
.pipe(gulp.dest('bin/win'));
});
There is some (about 5) *.proj
files in subdirectories of 'src/natives/'. When I use gulp
, it shows that msbuild
finish the build-win-executables
task just after the first file was processed:
[18:23:44] Using gulpfile Gulpfile.js
[18:23:44] Starting 'clean-win-bin'...
[18:23:44] Finished 'clean-win-bin' after 10 ms
[18:23:44] Starting 'build-win-executables'...
[18:23:44] MSBuild complete!
[18:23:44] Finished 'build-win-executables' after 343 ms
[18:23:44] Starting 'copy-win-executables'...
[18:23:44] Finished 'copy-win-executables' after 52 ms
[18:23:45] MSBuild complete!
[18:23:45] MSBuild complete!
[18:23:46] MSBuild complete!
[18:23:46] MSBuild complete!
[18:23:46] MSBuild complete!
Process finished with exit code 0
I'm not an expert in gulp
๐ , but I've found that emitting the 'end'
of the stream here causes the problem - after I've commented this line, all works as expected:
[18:26:55] Using gulpfile d:\testcafe-browser-natives\Gulpfile.js
[18:26:55] Starting 'clean-win-bin'...
[18:26:55] Finished 'clean-win-bin' after 10 ms
[18:26:55] Starting 'build-win-executables'...
[18:26:55] MSBuild complete!
[18:26:56] MSBuild complete!
[18:26:56] MSBuild complete!
[18:26:56] MSBuild complete!
[18:26:57] MSBuild complete!
[18:26:57] MSBuild complete!
[18:26:57] Finished 'build-win-executables' after 2.63 s
[18:26:57] Starting 'copy-win-executables'...
[18:26:57] Finished 'copy-win-executables' after 42 ms
Process finished with exit code 0
Version info
node@6.2.2 on Windows 10
npm@3.10.2
gulp-msbuild@0.3.3
gulp-cli@1.2.1
gulp@3.9.1
hoffi commented
Hm maybe this is a leftover from an older gulp version. I will look into it. Thanks for hinting! ๐