Build error: could not load file or assembly

I tested cloud build with a few projects and think it’s working very well. Most projects build without problems for iOS and Web, except one, which shows a build error.

In this project, it looks like a (non-native) .dll is not found/included in the build. The dll is referenced in other dlls, which are loaded properly. There are no references to it inside the game code, except from these dlls (uLink/uLobby networking library).

I’m not sure why this could happen, on my machine I’ve never had this problem, and I also checked out a new copy of the (git-)repo and it work, and everything is included. This is the part of the log:

559: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
560: [Unity] Assembly: Jboy.Core (assemblyref_index=3)
561: [Unity] Version: 0.0.0.0
562: [Unity] Public Key: (none)
563: [Unity] Could not load file or assembly 'Jboy.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
564: [Unity] Could not load file or assembly 'Jboy.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
565: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
566: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
567: [Unity] The class #=qFAYJp1_H3siNerZleeZS1jfELWTZLYpvIAsBscQ$Ek$cKruuKkASkRy8m4mUOqM$vumZlFp_HxiVXCsk4deeUA== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
568: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
569: [Unity] The class #=qzXxyCuZkFyefm0YLpS$9H7xtZ30wAThRRg$zA5r_gRH6cDe_zwxVoHYVerDeQqsjLgrscB6YcnPc73N91d0ZVg== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
570: [Unity] The class #=q30e0eFrOAg5DWJJCL$Df4H4oSjx9fm4bMqXeLMjyPlw= could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
571: [Unity] The class #=qzXxyCuZkFyefm0YLpS$9H7xtZ30wAThRRg$zA5r_gRH6cDe_zwxVoHYVerDeQqsjLgrscB6YcnPc73N91d0ZVg== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
572: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
573: [Unity] at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
574: [Unity] at System.Reflection.Assembly.GetTypes () [0x00000] in :0
575: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
576: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
577: [Unity] at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
578: [Unity] at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
579: [Unity] at Mono.CSharp.Driver.Compile () [0x00000] in :0
580: [Unity] at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
581: [Unity] - Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
582: [Unity] Internal compiler error. See the console log for more information. output was:
583: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
584: [Unity] at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
585: [Unity] at System.Reflection.Assembly.GetTypes () [0x00000] in :0
586: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
587: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
588: [Unity] at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
589: [Unity] at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
590: [Unity] at Mono.CSharp.Driver.Compile () [0x00000] in :0
591: [Unity] at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
592: [Unity] (Filename: Line: 0)

Also, later in the log, there’s a message which sounds like the not found dll (JBoy.dll) does not even exist as an asset. But there definitely are multiple files in this folder.

 [Unity] Refresh: detecting if any assets need to be imported or removed ... A meta data file (.meta) exists but its asset 'Assets/Plugins/Jboy/Library' can't be found. When moving or deleting files outside of Unity, please ensure that the corresponding .meta file is moved or deleted along with it.

files in the folder:

Jboy.Core.dll
Jboy.Core.dll.meta
Jboy.Core.xml
Jboy.Core.xml.meta
Jboy.dll
Jboy.dll.meta
Jboy.xml
Jboy.xml.meta

I also disabled code stripping but it doesn’t make a difference.

That’s good you like it so far and that so many projects work out of the box!

First of all, do you use the uLink/uLobby system for your desktop application? As uLink/uLobby does not seem to support mobiles, tell me if I’m wrong in this case.

Maybe it might be a bug, when Unity Cloud Build opens your project for the first time, it is as if it’s being opened in the Unity editor on another computer for the first time. Unity defaults to desktop platforms for this first load and not to mobiles and maybe this causes a problem with uLobby files.

I was able to make it work now by updating JBoy and moving it to another folder. I’m not sure what could have caused the problem, but it works now. The confusing thing was just that building worked on any machine I tested (even directly after checking out from the repository), but not on the build server.

That’s quite interesting and useful at all! Thanks for sharing the solution!

Hi any_user,

Glad you got it worked out! Out of curiosity, were you able to do a clean build from your local system with no problems?

yes, that worked without problems (tested with 4.5.3p1).

another thing I noticed: sometimes when building works successfully, there are some compiler error messages in the log, like:

[Unity] Initialize engine version: 4.5.3f3 (fca41a4fabea)
       [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
       [Unity] Compilation failed: 3 error(s), 0 warnings
       [Unity] error CS2001: Source file `Assets/Scripts/Core/ObjectManager.cs' could not be found
       [Unity] error CS2001: Source file `Assets/Scripts/Core/Player.cs' could not be found
       [Unity] error CS2001: Source file `Assets/Scripts/Player States/PlayerState.cs' could not be found
       [Unity] Internal compiler error. See the console log for more information. output was:error CS2001: Source file `Assets/Scripts/Core/ObjectManager.cs' could not be found
       [Unity] error CS2001: Source file `Assets/Scripts/Core/Player.cs' could not be found
       [Unity] error CS2001: Source file `Assets/Scripts/Player States/PlayerState.cs' could not be found
       [Unity] WARNING: Shader Unsupported: 'Reflective/VertexLit' - Invalid texture combiner
       [Unity] WARNING: Shader Unsupported: 'Legacy Shaders/Lightmapped/VertexLit' - Invalid texture combiner
       [Unity] WARNING: Shader Unsupported: 'Hidden/Nature/Terrain/Bumped Specular AddPass' - Pass 'FORWARD' shader state not supported
       [Unity] WARNING: Shader Unsupported: 'Nature/Terrain/Bumped Specular' - Pass 'FORWARD' shader state not supported
       [Unity] Finished exporting player successfully.

It’s not really a big issue, everything works like expected, but it’s a bit confusing. I think these are all objects that were deleted (or renamed in this case) since the previous build.

Hi @any_user - interesting, what kind of source / version control are you using? (Git, SVN, Perforce ?)

If you keep seeing these errors, please file a support ticket (in the ticket, let us know your Bundle / App ID) and we can check it out. Thanks!

I’m using git hosted on github.