"Roslyn/Microsoft.CSharp.Core.targets" was not found

Hello. I’m trying to import a project project of mine into MonoDevelop on Archlinux. When I try to run it, I get a single error message:

/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.

I’ve installed MonoGame 3.7.1 (Extension manager shows 3.7.0.1 working, but 3.7.1.189 gives an error about expecting Mono 6.0 but finds 7), dotnet-sdk. Why is something pointing to /usr/lib/mono/msbuild/15.0/bin/ when Roslyn is clearly in /usr/share/dotnet/dotnet/sdk/3.1.103/? In Preferences .NET core points to /usr/share/dotnet/dotnet, is some package I’m including messing this up? Wtf is going on here?

MonoGame 3.7.1 runs on .NET Framework or Mono, not .NET Core.

Mono 6.4.0 is installed, MonoDevelop detects Mono 6.4.0 listed as a .NET runtime, but MonoDevelop also wants .NET Core SDK (which it has detected and seems to work). Anyway, they’re both installed.

I’ve had this problem recently, You need to install mono-msbuild, but before that you have to either move or delete the problem folder: mv /usr/lib/mono/msbuild/15.0 /usr/lib/mono/msbuild/15.0-old, hope this helps, just about pulled my hair out trying to fix this error.

I had to remove monodevelop-stable before I could replace msbuild-stable with mono-msbuild. Seems like monodevelop-git doesn’t want to use mono-msbuild; when I try to reinstall MonoDevelop it demands that it replace mono-msbuild with msbuild-stable. So I went with monodevelop-bin, which installed fine. Still using monogame-bin. However now I’m getting:

error MSB4019: The imported project "/usr/lib/mono/xbuild/MonoGame/v3.0/MonoGame.Content.Builder.targets" was not found.

The only two places MonoGame.Content.Builder.targets exists are:

~/.nuget/packages/monogame.content.builder/3.7.0.9/build/MonoGame.Content.Builder.targets

and

/opt/monogame/MonoGame.Content.Builder.targets

What versions of mono, monogame, monodevelop, and msbuild are you using, if you don’t mind checking? Me:

$ pacman -Q mono monogame monodevelop msbuild
mono 6.4.0.198-1
monogame-bin 3.7.1-1
monodevelop-bin 7.8.4.1_0xamarin6_ubuntu1804b1-2
mono-msbuild 16.5.xamarinxplat.2020.01.10.05.36-1

I really want to use monogame-git because it seems way more up to date but it still doesn’t want to build (problem building openTK: index out of range exception)

Manually changing

<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />

to

<Import Project="\opt\monogame\MonoGame.Content.Builder.targets" />

seems to have fixed that particular problem, but this is probably not the best way to do it…

I have all the same versions of everything:

mono 6.4.0.198-1
monogame-bin 3.7.1-1
monodevelop-bin 7.8.4.1_0xamarin6_ubuntu1804b1-2
mono-msbuild 16.5.xamarinxplat.2020.01.10.05.36-1

I can’t seem to build monodevelop-git either, maybe see if you can build it from github?

What tool did you use to make the project?

Originally built the project with Visual Studio, MG content pipeline and TexturePacker.

Check if using the dotnet cli will create the correct imports.