0
\$\begingroup\$

I am creating a project in Unity 5 free and using external dlls. I have a scene that is running normally within Unity but when I try to build the project as a standalone windows game I get this error which stops the build

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

The following assembly referenced from C:\MyProject\Assets\Plugins\MyPlugin.Unity.dll could not be loaded:
     Assembly:   UnityEditor    (assemblyref_index=3)
     Version:    0.0.0.0
     Public Key: (none)
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (C:\MyProject\Assets\Plugins\).

Could not load file or assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Could not load file or assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

I guess there must be a mistake in the way the dll is loaded or something? What is causing this error?

EDIT The Visual studio projects build properly with no errors

\$\endgroup\$
  • \$\begingroup\$ Just to get the obvious question ourt of the way fiirst, does C:\MyProject\Assets\Plugins\MyPlugin.Unity.dll exist? \$\endgroup\$ – hobnob May 26 '16 at 12:55
  • \$\begingroup\$ @hobnob yes it exists \$\endgroup\$ – John Demetriou May 26 '16 at 13:08
  • \$\begingroup\$ @hobnob and the scene I am trying to build is running normally within unity \$\endgroup\$ – John Demetriou May 26 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.