(Solved) ArgumentException - Assembly System.web is referenced by log4net

I am trying to export my project for web and now getting the following error. I am running Unity Pro (4.1.5f1) on Mac.

Googled the issue, looked around the forum but couldn’t find a practical solution. There is a similar question i found but wasn’t helpful.

Build issue not finding .NET libraries and the suggested solution was

Any and all libraries that are .Net that you want to have with your project that Unity doesn’t know about, simply place them in your Assets folder somewhere on some level, maybe Resources, however, that doesn’t mean it will be allowed to be used even if it does exist, especially for the web player.

I don’t know about the .Net libraries. I am using Mac and making use of Unity’s default .Net libs.

Any help is greatly appreciated.

ArgumentException: The Assembly System.Web is referenced by log4net. But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target)
UnityEditor.HostView:OnGUI()

Have you tried out , in PlayerSettings , Api Compatibility Level , to switch to .Net 2.0 (instead of .Net 2.0 Subset) ?

When you build for a webplayer, there is a restriction on what Mono .Net DLLs are allowed to be included. There is a very long, slow to load html page here that tells you what is, and isn’t supported. System.Web is shown at the very bottom of this page, and it’s documented as not supported. Your game may not be using this directly, however, the build process has found that log4net uses System.Web features. If you don’t know that you are using log4net then life might get complicated. If you are using this, then simply use platform conditional compilation, and don’t use log4net when building for the web.

Got it working finally… Yaaay!

So for people who might get across this.

Graham was right, it was log4net problem. I had a asset resource (plugin) that was using log4net. I removed it from my solution. I wasn’t even using it. I imported it to test for something.

The plugin in my case was MotionKit. It doesn’t work on Mac either.

Anyways one way you could fine this is to search for log4net in your whole solution and see where it is. Fine the relevant source code and deal with it accordingly.

Hope this helps,
Ash