Search Unity

Build error: could not load file or assembly

Discussion in 'Unity Build Automation' started by any_user, Aug 21, 2014.

  1. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    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:

    Code (CSharp):
    1. 559: [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
    2. 560: [Unity] Assembly: Jboy.Core (assemblyref_index=3)
    3. 561: [Unity] Version: 0.0.0.0
    4. 562: [Unity] Public Key: (none)
    5. 563: [Unity] Could not load file or assembly 'Jboy.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    6. 564: [Unity] Could not load file or assembly 'Jboy.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    7. 565: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    8. 566: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    9. 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
    10. 568: [Unity] The class #=qd7J0SYAvaor4H__bG2ErshTKAZ8kFzdbpKGgTla4Q8diXSOG6VVu8l20qGCtVZQWNi6uSwxFik3Cbv92ISHwtQ== could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    11. 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
    12. 570: [Unity] The class #=q30e0eFrOAg5DWJJCL$Df4H4oSjx9fm4bMqXeLMjyPlw= could not be loaded, used in uGameDB, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    13. 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
    14. 572: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    15. 573: [Unity] at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    16. 574: [Unity] at System.Reflection.Assembly.GetTypes () [0x00000] in :0
    17. 575: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
    18. 576: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
    19. 577: [Unity] at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
    20. 578: [Unity] at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
    21. 579: [Unity] at Mono.CSharp.Driver.Compile () [0x00000] in :0
    22. 580: [Unity] at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
    23. 581: [Unity] - Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
    24. 582: [Unity] Internal compiler error. See the console log for more information. output was:
    25. 583: [Unity] Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    26. 584: [Unity] at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    27. 585: [Unity] at System.Reflection.Assembly.GetTypes () [0x00000] in :0
    28. 586: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
    29. 587: [Unity] at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
    30. 588: [Unity] at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
    31. 589: [Unity] at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
    32. 590: [Unity] at Mono.CSharp.Driver.Compile () [0x00000] in :0
    33. 591: [Unity] at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0
    34. 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.

    Code (CSharp):
    1.  [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:
    Code (CSharp):
    1. Jboy.Core.dll
    2. Jboy.Core.dll.meta
    3. Jboy.Core.xml
    4. Jboy.Core.xml.meta
    5. Jboy.dll
    6. Jboy.dll.meta
    7. Jboy.xml
    8. Jboy.xml.meta
    I also disabled code stripping but it doesn't make a difference.
     
  2. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    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.
     
  3. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    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.
     
  4. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    That's quite interesting and useful at all! Thanks for sharing the solution!
     
  5. hypeNate

    hypeNate

    Unity Technologies

    Joined:
    Apr 4, 2014
    Posts:
    272
    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?
     
  6. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    yes, that worked without problems (tested with 4.5.3p1).
     
  7. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    another thing I noticed: sometimes when building works successfully, there are some compiler error messages in the log, like:

    Code (CSharp):
    1. [Unity] Initialize engine version: 4.5.3f3 (fca41a4fabea)
    2.        [Unity] -----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
    3.        [Unity] Compilation failed: 3 error(s), 0 warnings
    4.        [Unity] error CS2001: Source file `Assets/Scripts/Core/ObjectManager.cs' could not be found
    5.       [Unity] error CS2001: Source file `Assets/Scripts/Core/Player.cs' could not be found
    6.        [Unity] error CS2001: Source file `Assets/Scripts/Player States/PlayerState.cs' could not be found
    7.       [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
    8.        [Unity] error CS2001: Source file `Assets/Scripts/Core/Player.cs' could not be found
    9.       [Unity] error CS2001: Source file `Assets/Scripts/Player States/PlayerState.cs' could not be found
    10.        [Unity] WARNING: Shader Unsupported: 'Reflective/VertexLit' - Invalid texture combiner
    11.        [Unity] WARNING: Shader Unsupported: 'Legacy Shaders/Lightmapped/VertexLit' - Invalid texture combiner
    12.        [Unity] WARNING: Shader Unsupported: 'Hidden/Nature/Terrain/Bumped Specular AddPass' - Pass 'FORWARD' shader state not supported
    13.        [Unity] WARNING: Shader Unsupported: 'Nature/Terrain/Bumped Specular' - Pass 'FORWARD' shader state not supported
    14.        [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.
     
  8. hypeNate

    hypeNate

    Unity Technologies

    Joined:
    Apr 4, 2014
    Posts:
    272
    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!
     
  9. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    I'm using git hosted on github.