[Solved] MonoGame.Content.Builder.Task 3.8 and Rider (exit code 127)

Hello,

I’ve recently tried to upgrade a game project from MonoGame 3.7 to 3.8 but I get this error on build:

  MonoGame.Content.Builder.Task.targets(138, 5): [MSB3073] The command "dotnet /home/vfrz/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/../tools/netcoreapp3.1/any/mgcb.dll /quiet /@:"/run/media/vfrz/Shared/GameDev/ProjectSommar/src/ProjectSommar/Content/GameContent.mgcb" /platform:DesktopGL /outputDir:"/run/media/vfrz/Shared/GameDev/ProjectSommar/src/ProjectSommar/Content/bin/DesktopGL/GameContent" /intermediateDir:"/run/media/vfrz/Shared/GameDev/ProjectSommar/src/ProjectSommar/Content/obj/DesktopGL/GameContent" /workingDir:"/run/media/vfrz/Shared/GameDev/ProjectSommar/src/ProjectSommar/Content/"" exited with code 127.

This is surely due to Rider, when I run it with user “root” I don’t have this problem but this is not a great solution. I can run the command dotnet build and dotnet run without any problem too.
Has anyone else encountered this problem? (And found a solution?)

Thanks in advance.

VFRZ

  1. Take the command printed in the output into your clipboard.
  2. Paste into a terminal session. Note: If you are on Windows, I highly recommend downloading Windows Subsystem for Linux and Windows Terminal. You can now do stuff in terminal in a cross-platform manner.
  3. Observe the output of the running pipeline tool. It will complain and print more useful information then what is shown here.
1 Like

Thanks for your help. I’ve already tried to copy/paste and execute the command into my terminal, it works fine. I am using Linux Manjaro.

So I’ve googled about what exit code 127 means, and it turns out to be about “command not found”. The problem is the command dotnet, I don’t really know why it does not work using my normal user and work with root user.

I fixed this by modifying the MonoGame.Content.Builder.Task.props file from the NuGet package from:
<DotnetCommand Condition="'$(DotnetCommand)' == ''">dotnet</DotnetCommand>
to
<DotnetCommand Condition="'$(DotnetCommand)' == ''">/opt/dotnet/dotnet</DotnetCommand>

Now it works perfectly.

Thanks for your help and hope it can be useful to others :slight_smile:

So you moved the dotnet folder to the opt folder where root rights are not necessary?

My dotnet folder has always been in the opt folder. I don’t use any package for it, I install it manually because sometimes I need to install daily builds of .NET 5.
I believe the problem is that Rider is executing the command in a strange context where it can’t found the dotnet command without the full path to it.

1 Like