- Home /
Web build System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
I am upgrading my request for help on this forum: http://forum.unity3d.com/threads/web-build-compiler-error.192090/
The problem is I cannot add one of my library's to the project.
It is compiled with .Net3.5 and only references System and two utility libraries(which themselves only reference system and are .Net3.5 compiled). I can build for stand alone fine but switching to web breaks it. I tried 2.0 but there are so many extension methods, there was no easy way to test that. Hopefully not the answer as i will have to re-wright a lot!
Any other suggestions? Went through two pages of Google results but most people were simply using the wrong .Net.
I had another very similar error message that was caused by not including some of the referenced dll's in my main dll. Sure that is not the case this time.
Update:
Isolated each file until i found the one that caused the issue. I have a enum.cs file with a list of enums and at the bottom this class and extension method:
public static class enumExtensions
{
public static string DatabaseName(this MySystem System)
{
switch (System)
{
default: return "null";
}
}
}
Cannot figure for the life of me why that is an issue. Any suggestions?
Answer by dkely · Jul 02, 2014 at 03:57 PM
I added this to the extension method file:
namespace System.Runtime.CompilerServices
{
public class ExtensionAttribute : Attribute { }
}
...and after that all my sins were forgiven and all was right in the world of mortals.
Answer by nfbayboy · May 29, 2015 at 09:12 AM
I have the same error with importing an asset. This was my fix:
Select: File
Build Settings
Player Settings (button at the bottom of the opened window)
Check the inspector and select Other Settings
Under Optimization, my setting for API compatibility level was set to .NET 2.0 Subset
I changed it to .NET 2.0
That's it, this worked for me.