hoffi/gulp-msbuild

gulp-msbuild does not appear to be calling MSBUILD (possible setup issue on my part?)

Closed this issue · 8 comments

Hello,

I inherited a project which uses gulp-msbuild, and I can't seem to get it to work. The gulp task runs, but it doesn't seem to be actually calling MSBUILD. I suspect it is a path problem or something. My gulpfile is in a subdirectory one level down from my Visual Studio solution file, which contains my MSBUILD tasks. The gulp task looks like this:

gulp.task('msbuild', function (cb) {
log('Building Visual Studio solution');
return gulp.src(pkg.paths.solution)
.pipe(plug.msbuild({
targets: ['Clean', 'Build'],
toolsVersion: 12.0 // Default: 4.0
}, cb));

});

The pkg.paths.solution variable points to a property of a JS object in the package.json file; that value looks like this:

"./TheSolutionName.sln",

The "plug.msbuild" aspect of it uses

var plug = require('gulp-load-plugins')();

That should not be the issue, because we have many other gulp tasks which use "gulp-load-plugins", and they're working fine.

I can run MSBUILD directly, from the DOS command line (it's a Windows 7 machine), when I'm at the same directory where the .sln file resides; that works. But when I try to do it from the gulp task, gulp-msbuild doesn't actually seem to be calling it.

Because I couldn't find a lot of documentation by googling (trying to find debugging or troubleshooting advice), that suggests most people must be using it without any problems.

Still, I just wanted to verify,

  • it actually works, is that correct? People are out there in the field, using it?
  • do you see anything wrong with the format of my path variable that points to the solution?
  • it should behave just like MSBUILD that runs at the command line? From reading the source code, it just appears to be a wrapper around the MSBUILD command line. For example, if I specify a verbosity level which should send the MSBUILD output text to the console, then when I call it from gulp-msbuild, it should output that text in the same way that MSBUILD itself would do, if I called it from the command line?
  • can you suggest any debugging tricks so I can try and see why it does not appear to be calling my MSBUILD tasks? (What I'm trying to do is very simple; I just want to do a "Clean" and "Rebuild", and maybe also do another task I have which does a one-off transformation of a web.config file.)

Any help appreciated

Thank you,

Dave

hoffi commented

Hello @davidbarrows

gulp-msbuild is just a wrapper that calls the MSBUILD-Executable internally.
You can see the complete command that will be executed by gulp-msbuild when you specify the logCommand-Option to gulp-msbuild this way:

plug.msbuild({
  targets: ['Clean', 'Build'],
  toolsVersion: 12.0 // Default: 4.0,
  logCommand: true
}, cb)

Maybe this points out the problem.

About that path thing i'm not sure if i can follow you. What i understood is that you pass the path of a property in your package.json that contains ./SolutionName.sln to your gulp-Task?

Isn't that the wrong path when you say that your Gulpfile is not in the same directory as the Solutionfile? From what you described you should pass ../SolutionName.sln to gulp-msbuild as your SolutionFile is in the top-level directory.

Hope this helps,

Stefan

Hi Stefan, thanks very much for this additional information. This may help me debug the problem. I appreciate it.

Best regards,
Dave

hoffi commented

Hey @davidbarrows,

did it worked?

Hi Stefan, I haven't had a chance to do it yet, sorry... then I go on
holiday next week for a few days. So it will be a little while before I
can give you an answer. But it is a priority for me to get it to work so
as soon as I have time to work on it further I will get you some more
information.

Many thanks
Dave

On Wed, Jun 10, 2015 at 5:12 PM, Stefan Hoffmann notifications@github.com
wrote:

Hey @davidbarrows https://github.com/davidbarrows,

did it worked?


Reply to this email directly or view it on GitHub
#20 (comment).

hoffi commented

No stress :)

Hi Stefan, I'm back from holiday; I tried the "logCommand" option as you
suggested and I can see the MSBUILD command that the gulp-msbuild plug-in
appears to be executing. When I execute that same command manually from
the command line, I get a lot of output from MSBUILD; but when the plug-in
runs the command, it does not produce that MSBUILD output. Is there a way
to get the execution to return the MSBUILD output, in the same way that it
does when MSBUILD.EXE is run manually from the command line?

Many thanks
Dave

On Wed, Jun 10, 2015 at 5:29 PM, Stefan Hoffmann notifications@github.com
wrote:

No stress :)


Reply to this email directly or view it on GitHub
#20 (comment).

Actually never mind, I figured it out (using the "stdout" option). So,
it's all working; my problem was the path was incorrect. (User error!)

thanks for getting back to me

Best regards,
Dave Barrows

On Fri, Jun 19, 2015 at 12:02 PM, David Barrows david.w.barrows@gmail.com
wrote:

Hi Stefan, I'm back from holiday; I tried the "logCommand" option as you
suggested and I can see the MSBUILD command that the gulp-msbuild plug-in
appears to be executing. When I execute that same command manually from
the command line, I get a lot of output from MSBUILD; but when the plug-in
runs the command, it does not produce that MSBUILD output. Is there a way
to get the execution to return the MSBUILD output, in the same way that it
does when MSBUILD.EXE is run manually from the command line?

Many thanks
Dave

On Wed, Jun 10, 2015 at 5:29 PM, Stefan Hoffmann <notifications@github.com

wrote:

No stress :)


Reply to this email directly or view it on GitHub
#20 (comment).

hoffi commented

No problem