+2 votes

I am using GodotSharp 3.2.3.

The project runs in the editor, but when I export my project for Windows using MSBuild (VS Build Tools), a .exe is produced; upon running it I get the error: The assembly 'GodotSharp' is out of sync.

When setting up my project, I followed the steps here to set up Godot C# for Windows.

I'm using VS Code as my external editor. My .csproj file looks like this:

<Project Sdk="Godot.NET.Sdk/3.2.3">
  <PropertyGroup>
    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
    <TargetFramework>net472</TargetFramework>
    <LangVersion>7.3</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="GodotSharp" Version="3.2.3" />
  </ItemGroup>
</Project>

So far I've tried:
- Deleting and re-creating my .csproj files
- Deleting the .mono directory and letting it rebuild
- Exporting to a different folder location

The full error I see in my log file is:

**ERROR**: The assembly 'GodotSharp' is out of sync.
   At: modules/mono/mono_gd/gd_mono.cpp:954:_load_api_assemblies() - The assembly 'GodotSharp' is out of sync.
**ERROR**: FATAL: Method failed.
   At: modules/mono/mono_gd/gd_mono.cpp:965:_load_api_assemblies() - FATAL: Method failed.

What does it mean that an assembly is 'out of sync?' How can I produce an exported .exe that runs successfully?

Godot version v3.2.3.stable.mono.official
in Engine by (37 points)

2 Answers

0 votes

I have this issue as well and have been troubleshooting it for a few days. The error message is profoundly unhelpful, and the mono log doesn't provide any additional relevant information either.

I think I've figured it out though, my project successfully exports now.

Something in Godot's export system doesn't play nice with nuget packages. I've worked around this by manually including the .dll files from all the nuget packages I need into the assembly, and then removing the nuget packages from the project. After doing that you'll probably need to clear out your build cache for visual studio, and you'll definitely need to delete your .mono folder in the Godot project.

I've reproduced the problem in Godot versions 3.2.3-stable_mono & 3.3-rc6_mono.
I'm not sure if we need to report a new issue, or reopen this one.

by (22 points)
0 votes

I'm having the same issue and haven't been able to get an answer to my problem too. I have tried most of the following

Corrupted .csproj or .sln

The first thing I came across was that the .csproj or .sln projects were corrupted from updating the godot version. So I went through the process of deleting the two and reconstructing my project. I also deleted all the cached data in the .mono, obj, and build directories. This didn't help me fix my problem. I didn't think I had updated my godot version, but I figured "what the heck".

This issue was also talking about Godot 3.0.4

Unsupported Nuget Package Structure

It seems that one of the issues could be related to how nuget creates packages. The documentation states to change the way packages are listed. Using NuGet in Godot. They say that you need to nest the Version in it's own tag instead of data in the PackageReference

From:

<ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2"/>
</ItemGroup>

To:

<ItemGroup>
    <PackageReference Include="Newtonsoft.Json">
        <Version>11.0.2</Version>
    </PackageReference>
</ItemGroup>

Mono MsBuild Properties

There was also mention of a fix of Mono's MsBuild properties but this appears to be a fix for Godot 3.1.1 and not for the current version 3.2.3.

General -> Mono -> Builds -> Build Tool: MSBuild (VS Build Tools) if on Windows or MSBuild (Mono) for other platforms.

Where General -> Mono -> Builds, the Builds menu doesn't exist in 3.2.3

Mono Glue Code Out Of Data

This one was related but I don't think was relevant. It was talking about rebuilding the mono/godot executables because they made changes to some things. Mono 3.2 Game on Android crash with custom export template. Feel free to take a look and see if this is at all relevant. I didn't go though this because it seemed complicated and he was doing something more than I was.

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.