0
votes

A task of my Azure DevOps build fails to find my solution path when I change from "Hosted" Agent to "Hosted VS2017".

Does the folder organisation change from a agent to another ?

My C# solution used to run with .NET framework 4.6, and I reference now 4.7.1 version. That's why I need apparently to use "Hosted VS2017" agent instead of the default "Hosted" agent. But a task that uses a gulpfile fails when trying to build my solution. I tried to execute the build with diagnostics, but I got no more informations than "The system cannot find the path specified." in my first MSbuild command.

---

[command]C:\npm\prefix\gulp.cmd CI-default --gulpfile D:\a\1\s\source\back-end\gulpfile.js
[‌15:41:53‌] Using gulpfile D:\a\1\s\source\back-end\gulpfile.js‌
[‌15:41:53‌] Starting 'CI-default'...‌
[‌15:41:53‌] Starting 'Publish-All-Projects'...‌
[‌15:41:53‌] Starting 'Build-Solution'...‌
[‌15:41:53‌] Using automatic maxcpucount‌
The system cannot find the path specified.
[‌15:41:53‌] { Error: Command failed: "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\a\1\s\source\back-end\******.sln" "/target:Build" /verbosity:minimal /toolsversion:14.0 /nologo /maxcpucount /property:Configuration="Release"‌
The system cannot find the path specified.

 at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
  killed: false,
  code: 1,
  signal: null,
  cmd:
   '"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe" "D:\\a\\1\\s\\source\\back-end\\ALE.sln" "/target:Build" /verbosity:minimal /toolsversion:14.0 /nologo /maxcpucount /property:Configuration="Release"' }


---

The build fails at this steps but should execute properly (it does actually when I do it with the default "Hosted" agent or on my local machine with Visual Studio)

1
You haven't actually showed us the pipeline, but have you installed gulp before trying to use it?Jabberwocky
Like I said, the build worked properly with another agent so I suppose it is installed.Thomas GRIESMAR
Again, without showing your pipeline, I can't really help, but try installing gulp or npm install (depending on how your package.json looks like) first as a step and then run it again. Also, is your MSBuild step pointing to the solution?Jabberwocky

1 Answers

2
votes

Why is my MSbuild command path not reachable if I change my Azure DevOps agent?

That because the Visual Studio 2015 is installed by default on the "Hosted" Agent, and Hosted VS2017 with Visual Studio 2017 by default.

However, the path for the MSBuild 14.0 and 15.0 are different.

The default path for MSBuild 14.0 is C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe.

But the default pathfor the MSBuild 15.0, the path is C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe.

So to resolve this issue, you should change the MSBuild in your CMD scripts:

 cmd:
   '"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe"

To

 cmd:
   C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\15.0\Bin\\MSBuild.exe

Hope this helps.