0

I'm compiling the sources in Visual Studio Community 2017 for Mac and I've got the following error:

Building: ServiceLayer.API (Debug)
Error: Build failed. See the build log for details. (ServiceLayer.API)
---------------------- Done ----------------------
Build failed.
Build: 1 error, 0 warnings

In Ide.log log file, I've the following entry:

ERROR [2017-10-08 20:20:45Z]: Inspector does not support this project type
ERROR [2017-10-08 20:20:45Z]: Build failed.
System.Exception: Did not find MSBuild for runtime Mono 4.0.2 (c99aa0c)
  at MonoDevelop.Projects.MSBuild.MSBuildProjectService.GetNewestInstalledToolsVersion (MonoDevelop.Core.Assemblies.TargetRuntime runtime, System.Boolean requiresMicrosoftBuild, System.String& binDir) [0x0006e] in /Users/builder/data/lanes/5144/cab57de4/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs:1087 
  at MonoDevelop.Projects.MSBuild.MSBuildProjectService+<GetProjectBuilder>d__100.MoveNext () [0x00133] in /Users/builder/data/lanes/5144/cab57de4/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs:1116
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
  at MonoDevelop.Projects.Project+<GetProjectBuilder>d__157.MoveNext () [0x001bb] in /Users/builder/data/lanes/5144/cab57de4/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1418 
...
ERROR [2017-10-08 20:21:16Z]: An unhandled exception has occured. Terminating Visual Studio? False

Notes: In total like 381 lines on each attempt to build. 'End of stack trace' line is repeated 52 times.

This pointed me to this line in MonoDevelop (see: MSBuildProjectService.cs):

throw new Exception ("Did not find MSBuild for runtime " + runtime.Id);

I've checked and msbuild command exist in the command-line:

$ which msbuild
/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild
$ msbuild --version
Microsoft (R) Build Engine version 15.4.0.0 (master/f296e67b Thu Sep 21 19:38:16 EDT 2017) for Mono
$ stat /Library/Frameworks/Mono.framework/Versions/Current
  File: /Library/Frameworks/Mono.framework/Versions/Current -> /Library/Frameworks/Mono.framework/Versions/5.4.0

What I've tried so far:

  • I've tested both channels (Stable and Beta) in Visual Studio Update without success.
  • I've tried to Clean All and Rebuild All.
  • I've tried to remove the cache files in ~/Library/Caches/VisualStudio.
  • Reinstalling VisualStudio.

I've checked in Visual Studio, Preference..., Projects, .NET Runtimes and I've the latest Mono set as Default (to 5.4.x):

Mono, *Visual Studio*, *Preference...*, *Projects*, *.NET Runtimes*

However when debugging, it's trying to open msbuild for 4.0.2 instead, e.g.:

$ sudo fs_usage -f pathname VisualStudio | grep -i msbuild
12:34:38  stat64            /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/msbuild>>>>>>>>>>>>>>>>>>>>>>    0.000007   VisualStudio
12:34:38  lstat64           /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/msbuild>>>>>>>>>>>>>>>>>>>>>>    0.000002   VisualStudio
12:34:38  access            /Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/msbuild>>>>>>>>>>>>>>>>>>>>>>    0.000002   VisualStudio

which doesn't exist.


How should I add a missing MSBuild to my Solution (project) (as per mentioned error)?

2
  • What is your project type? Is desktop framework? How about this issue for a new blank c# project, like class library?
    – Leo Liu
    Oct 10, 2017 at 8:14
  • @Leo-MSFT It's a service API framework which handles the APIs from the web app and talks to the payment system. It works on Windows slave when build from Jenkins, so basically I'm trying to debug it on my local, but VS basically stopped working properly for some reason.
    – kenorb
    Oct 10, 2017 at 9:57

1 Answer 1

1

Mono 4.0.2 did not have msbuild, it was included in 4.8.0+ . Check where does /Library/Frameworks/Mono.framework/Versions/Current (symlink) point to. It probably points to some mono 5.x.y . Try changing the .NET runtime that VSMac is set to use in Preferences -> Projects -> .NET Runtimes, to the latest one.

For some reason it is still looking it in 4.0.2. I would try to, at least temporarily, remove that 4.0.2 directory and then check. But otherwise I think your installation is broken and I would try to reinstall the whole thing (VSMac, Mono, ..).

Also, check in your Ide.log file for any references to 4.0.2, before that exception.

If you run into the same issue even with a fresh install, then please file a bug at bugzilla.xamarin.com and we can try to debug it there.

5
  • /Library/Frameworks/Mono.framework/Versions/Current -> /Library/Frameworks/Mono.framework/Versions/5.4.0
    – kenorb
    Oct 9, 2017 at 9:35
  • In Preferences I've already the latest one, which is 5.4.0.201
    – kenorb
    Oct 9, 2017 at 9:40
  • 1
    For some reason it is still looking in 4.0.2. I would try to, at least temporarily, remove that 4.0.2 directory and then check. But otherwise I think your installation is broken and I would try to reinstall the whole thing (VSMac, Mono, ..) . If you run into the same issue even with a fresh install, then please file a bug at bugzilla.xamarin.com and we can try to debug it there.
    – radical
    Oct 9, 2017 at 18:41
  • Also, in your Ide.log do you see any reference to 4.0.2 before that exception? sharing that log file should be useful too.
    – radical
    Oct 9, 2017 at 18:42
  • Reported issue at #60103, I've attached the log file there (you can check), but there is nothing obvious. I'll also try to debug this further soon. What's clear now, somehow VC incorrectly looking for msbuild binary inside 4.0.2 folder (see my edit).
    – kenorb
    Oct 10, 2017 at 19:40

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.