hoffi/gulp-msbuild

spawn xbuild ENOENT (Gulp on a Mac)

Closed this issue · 5 comments

I just installed gulp-msbuild in my Gulp project on my Mac.
I have a Window 7 VM running IIS and Visual Studio 2015
My code is hosted on my Mac

Normally I log into my VM and do a build via VS15 or MSBuild from the command line. I am trying to setup a system where I never have to log into the VM and I think gulp-msbuild is my solution.

Here is my gulp code, below is my error.

GULP

gulp.task('msbuild', () => {
    return gulp.src(config.env.build)
        .pipe(msbuild({
            customArgs: ['/p:DeployOnBuild=true /p:PublishProfile=MyProject'],
            logCommand: true
            })
        );
});

ERROR

[14:44:23] Using MSBuild command: xbuild /Users/sethk/Documents/workspace/project.sln /target:Rebuild /verbosity:normal /toolsversion:4.0 /nologo /property:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=MyProject
[14:44:23] { [Error: spawn xbuild ENOENT]
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn xbuild',
  path: 'xbuild',
  spawnargs: 
   [ '/Users/sethk/Documents/workspace/project.sln',
     '/target:Rebuild',
     '/verbosity:normal',
     '/toolsversion:4.0',
     '/nologo',
     '/property:Configuration=Release',
     '/p:DeployOnBuild=true /p:PublishProfile=MyProject' ] }
[14:44:23] MSBuild failed!
[14:44:23] MSBuild failed with code -2!
[14:44:23] 'msbuild' errored after 35 ms

Is there something I am doing wrong or will this plugin only work while running gulp on the PC?

hoffi commented

spawn xbuild ENOENT looks like the XBuild-Executable could not be found.
Make sure you have installed Mono on your Mac and the XBuild-Executable is available (you can check this using $ which xbuild)

However since you initially developed your project on Windows you might need to port it to Mono and it could happen that the MSBuild run could still fail if your code is using .NET-Features that are not supported in Mono. You can find more about this on Mono Compatibility.

Hope this helps

Looking into it, I will keep you posted. Thanks!

Good and Bad news. Good news is that installing Mono helps! Bad new is now I get an error that looks like this:

[11:03:47] Using MSBuild command: xbuild /Users/sethk/Documents/workspace/ascension-sitecore /target:Rebuild /verbosity:normal /toolsversion:4.0 /nologo /property:Configuration=Release [11:03:47] MSBuild failed with code 1!

Update... It works great I had the wrong path to my .sln file.

hoffi commented

Nice to hear 👍 :)