Godot: error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found

Created on 23 Nov 2019  路  14Comments  路  Source: godotengine/godot

Godot version:
3.2 Beta 2 Mono

OS/device including version:
Manjaro/XPS 15 9560

Issue description:
When I try to build a project (new project with a Node2D and a icon in it) it trows an error:

Project "TestC#3.2-b3.sln" (Build target(s)):
    Message: Building solution configuration "Tools|Any CPU".
    Project "TestC#3.2-b3.csproj" (default targets):
        /usr/lib/mono/msbuild/15.0/bin/Microsoft.CSharp.CurrentVersion.targets(331,5): error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [/home/georgi/Development/Godot/TestC#3.2-b3/TestC#3.2-b3.csproj]
    Done building project "TestC#3.2-b3.csproj" -- FAILED.
Done building project "TestC#3.2-b3.sln" -- FAILED.

Steps to reproduce:

  1. Create a Project
  2. Create a scene with Node2D root and add an icon (drag the Godot logo into the scene)
  3. Attach a C# Script to the Node2D
  4. Save & Build the project

Minimal reproduction project:
project.zip

documentation enhancement editor mono

Most helpful comment

Found it, it was mono-msbuild, although I had to rename the conflicting problem folder with mv /usr/lib/mono/msbuild/15.0 /usr/lib/mono/msbuild/15.0-old

All 14 comments

There's no 3.2 beta 3 yet :)

What version of Mono and MSBuild do you have? It seems like your MSBuild is too old or wrongly setup.

Oh, my bad. I meant Beta 2 :P

I am running MSBuild 16:

Microsoft (R) Build Engine version 16.0.0.0 for Mono

Mono:

Mono JIT compiler version 6.0.0 (makepkg/6256b82d62f Fri 20 Sep 2019 11:18:59 PM -03)

The beta 2 build is made with Mono 6.6.0 Preview, but it should likely work with earlier 6.x versions too. On the other hand I did have to upgrade MSBuild from 16.0 to 16.3 to build with Mono 6.6.0, so that might be the issue.

Thanks! Will attempt upgrading to msbuild 16.3 and report back :)

@neikeq If this is confirmed to be the problem, we should probably update the editor so that it tests the msbuild version and notifies the user if it's too old for the included mono SDK.

The required version should also be made clear in the documentation.

I was able to test and use msbuild 16.4 (couldn't get 16.3 to install); dotnet core 3.0 and mono 6.0 seemed to have resolved the above error.

However, I am getting the following error below:

Godot_v3.2-beta2_mono_x11_64]$ Mono: Logfile is: /home/user/mono_logs/2019_11_25 19.51.24 (6867).txt
ERROR: get_as_ratio: Cannot get ratio when minimum and maximum value are equal.
   At: scene/gui/range.cpp:176.

@georgikoemdzhiev Thanks for the confirmation.

That error is not related to this bug, it just tells you that some code uses a Range node with min == max, which is problematic for the get_as_ratio method. It might be your own code, or it might be a bug of the editor itself, in which case it would be good to report as a new issue.

Not a problem :) Yes, you are right, will check if there is a bug opened about that error. Thanks 馃憤

Now I remember that I ran into the same issue when first upgrading our official containers to Mono 6.6.0 Preview (from 5.18.1.3). This is related to mono/mono#14875.

The problem I had, which is likely the one you ran into too, is that the upstream Mono packaging around the /usr/lib/mono/msbuild/15.0 folder changed in 6.0.x.

In 5.x, Mono would install its MSBuild-related assemblies in /usr/lib/mono/msbuild/15.0, and the msbuild packages provided by the upstream Mono team would also install their assemblies in /usr/lib/mono/msbuild/15.0.

After 6.0.x, if you build Mono yourself or install a newer upstream package without upgraded msbuild, there's a packaging change. Assemblies now go to /usr/lib/mono/msbuild/Current, and /usr/lib/mono/msbuild/15.0 is a symbolic link to the former. But if you then install msbuild 15.x packages, they will remove the symlink and add their assemblies in /usr/lib/mono/msbuild/15.0, so there's a version mismatch. Such system would have both /usr/lib/mono/msbuild/Current and /usr/lib/mono/msbuild/15.0 with different files, when they're meant to be one single folder.

Ensuring to msbuild 16.x for mono 6.x seems to be good enough. Otherwise one might need to move things around manually between those two conflicting folders, and to redo the symlink if it was replaced by a plain directory.

I'll close as I think it's not worth adding a troubleshooting section to our docs for this transient Linux packaging quirk, but if anyone lands here, this should hopefully help solve the issue.

Any advice for what to do if the symlink from 15.0 -> Current is present but the Roslyn dir is missing in Current?

Microsoft (R) Build Engine version 16.5.0-ci for Mono
Mono JIT compiler version 6.8.0.105

Check where your msbuild package installed Roslyn with your distro's tools. (Assuming you're on Linux. Otherwise, reinstall the Mono SDK.)

resolved on ubuntu 20.04 with

# apt install mono-roslyn

Anyone know if there's an arch package, aur or otherwise, that can solve this?

Found it, it was mono-msbuild, although I had to rename the conflicting problem folder with mv /usr/lib/mono/msbuild/15.0 /usr/lib/mono/msbuild/15.0-old

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blurymind picture blurymind  路  3Comments

Zylann picture Zylann  路  3Comments

testman42 picture testman42  路  3Comments

RebelliousX picture RebelliousX  路  3Comments

n-pigeon picture n-pigeon  路  3Comments