Godot: Failed to build GodotSharp solution

Created on 22 Feb 2019  ·  24Comments  ·  Source: godotengine/godot

Godot version:
3.1 beta 5 Mono x64
3.1 beta 6 Mono x64
3.1 beta 7 Mono x64
3.1 beta 8 Mono x64

OS/device including version:
Windows 10 / Acer Aspire E15

Issue description:
C# build fails

Steps to reproduce:
1) Clone the following project
https://github.com/StStep/ink-godot-example
2) Open it in Godot
3) Observe build error:

Проект "GodotSharp.sln" (целевые объекты Build):
Message: Создание конфигурации решения "Release|Any CPU".
Проект "GodotSharp.csproj" (целевые объекты по умолчанию):
C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(2126,5): error MSB4018: непредвиденная ошибка при выполнении задачи ResolveAssemblyReference".
System.NullReferenceException: Object reference not set to an instance of an object

archived bug windows mono

Most helpful comment

When I changed it the first time, it was an error MSB3644 for ".NETFramework,Version=v4.5", then I edited the csproj file and manually changed
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
to
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
After that, the project was built and ran successfully!
By the way, maybe there is some option for selection of target framework version from within the Godot? :)

All 24 comments

The linked project was made for Godot 3.0 alpha 2, it's not unexpected that it would no longer be compatible with 3.1 beta 6.

I would advise to open an issue on https://github.com/StStep/ink-godot-example asking to update the project for compatibility with Godot 3.1.

I'll let @neikeq review if something should be done on Godot's end, but IMO this needs to be debugged in https://github.com/StStep/ink-godot-example first.

test1.zip
OK, here is new test project, just created in this new 3.1 beta 6
One spatial node & default cs script
image

test1.zip project above works nicely in 3.1 beta 4

...but failed to build with the same error in 3.1 beta 5

The attached project builds fine for me with 3.1 beta 6 on Linux, with MSbuild 16.0.0.0 from Mono.

C:\Program Files\Mono\bin>mono --version
Mono JIT compiler version 5.12.0 (Visual Studio built mono)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: Thread + polling
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: supported, not enabled.
GC: sgen (concurrent by default)

C:\Program Files\Mono\bin>msbuild.bat
Microsoft (R) Build Engine версии 15.7.224.30163 (xplat-master/d375bb6e Sat Jun 30 05:26:28 EDT 2018) для Mono

My Mono versions, hope that helps

There is also message in the log output:
ERROR: initialize: The loaded Core API assembly is out of sync
At: modules/mono/mono_gd/gd_mono.cpp:356
Mono: Proceeding to unload scripts domain because of invalid API assemblies.

The same error is in the recent build 3.1 beta 7
log output is clean this time, but the error in the build log is the same.

The same error is in the recent build 3.1 beta 8
Error in log:
ERROR: call_build: A Godot Engine build callback failed.
At: editor/editor_node.cpp:4532
This time the project was opened successfully, but failed at the build stage when I tried to run the game,

Tested on Linux with 3.1 beta 8, still works fine for me. I guess it's specific to Windows or your configuration.

Can you try changing Editor Settings > Mono > Builds > Build Tool to MSBuild (VS Build Tools) and see if it builds correctly? It requires Visual Studio or Visual Studio Build Tools to be installed.
We've experienced several issues with Mono's msbuild.bat on Windows so it's not recommended for now.

When I changed it the first time, it was an error MSB3644 for ".NETFramework,Version=v4.5", then I edited the csproj file and manually changed
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
to
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
After that, the project was built and ran successfully!
By the way, maybe there is some option for selection of target framework version from within the Godot? :)

Hmm, I had a similar issue yesterday. I had to delete the .mono/temp folder. Not sure if running the "clean solution" command would work as well.

Just tried on the latest beta 9, running with Mono still causing the same errors.
BUT changing to the MS Build tools indeed helps, with the only downside that I need to change target framework from v4.5 to v4.5.2 manually. Maybe it is really viable workaround for Windows system, then...

Have you tried my last suggestion instead of switching the TargetFramework to v4.5.2?

Yes, I tried to delete .mono/temp folder, but this does not help, unfortunately
Visual Studio's msbuild complains about missing NETFramework,Version=v4.5, Mono's msbuild complains about System.NullReferenceException: Object reference not set to an instance of an object

Yeah, I guess I'm a victim of this now as well.
I could build the first commits of v3.2 myself and they worked fine but now I'm getting this all the time.

image

That's the Visual Studio output because it looks cleaner.
It the same that gets written to mono's logs anyway.

also I wonder what could be going on here

image

image

@piratesephiroth That's a different issue which was fixed by #27729

oh thanks, I'll try again

@Antokolos Can you still reproduce this issue in the latest Godot 3.2 builds?

Yes, without changing the target framework from v4.5 to v4.5.2 manually in the csproj file the project does not compile. Deletion of .mono/temp folder does not help either.

@Antokolos have you tried installing that version of the .NET Framework? MSBuild on Windows does not use Mono's framework when resolving assemblies (not even the MSBuild version Mono ships). So you need to install the .NET Framework.

@neikeq , I don't remember quite well, but I tried to install v4.5, and it seems that it does not help. Or maybe I've done something wrong :)
Anyway, I'm OK with changing the target framework from v4.5 to v4.5.2 manually in the csproj file workaround, it is fixing the issue for me.
So we can close this issue, if it does not bother significant number of people.

Seems like an issue specific to a partial installation of the .NET Framework, so let's close. If the docs are not clear on what needs to be installed exactly, they might need some improvement.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timoschwarzer picture timoschwarzer  ·  3Comments

RebelliousX picture RebelliousX  ·  3Comments

testman42 picture testman42  ·  3Comments

nunodonato picture nunodonato  ·  3Comments

bojidar-bg picture bojidar-bg  ·  3Comments