godot: error MSB4019: The imported project "/usr/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets" was not found
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:
- Create a Project
- Create a scene with Node2D root and add an icon (drag the Godot logo into the scene)
- Attach a C# Script to the Node2D
- Save & Build the project
Minimal reproduction project: project.zip
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (10 by maintainers)
Found it, it was
mono-msbuild
, although I had to rename the conflicting problem folder withmv /usr/lib/mono/msbuild/15.0 /usr/lib/mono/msbuild/15.0-old
resolved on ubuntu 20.04 with
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.
Check where your msbuild package installed Roslyn with your distro’s tools. (Assuming you’re on Linux. Otherwise, reinstall the Mono SDK.)
@georgikoemdzhiev Thanks for the confirmation.
That error is not related to this bug, it just tells you that some code uses a
Range
node withmin == max
, which is problematic for theget_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.@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.
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.
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.