The Assembly UnityEditor is referenced by Assembly-CSharp
I get this error and I don't understand why: ArgumentException: The Assembly UnityEditor is referenced by Assembly-CSharp ('Library/ScriptAssemblies/Assembly-CSharp.dll'). But the dll is not allowed to be included or could not be found.
I know that it means that the Assembly-CSharp.dll has some code that linking it to Editor dll, but the code that is generating this issue is this one (not an editor script):
#if UNITY_EDITOR
// If we're in the editor, create the game object with hide flags set right away
GameObject go = UnityEditor.EditorUtility.CreateGameObjectWithHideFlags(name,
#if SHOW_HIDDEN_OBJECTS
HideFlags.DontSave | HideFlags.NotEditable, typeof(UIDrawCall));
#else
HideFlags.HideAndDontSave, typeof(UIDrawCall));
#endif
UIDrawCall dc = go.GetComponent<UIDrawCall>();
#else
GameObject go = new GameObject(name);
DontDestroyOnLoad(go);
UIDrawCall dc = go.AddComponent<UIDrawCall>();
#endif
Considering that the code is handled with #if UNITY_EDITOR, i don't see the reason why i get that error (i made the basic test #if UNITY_EDITOR1 and the build error disappeared)
This issue happens onUnity 5.5.0f3 , on a project upgraded from Unity 5.3
Any ideas how i can fix this?
Answer by zaneev10 · Mar 15, 2017 at 03:31 PM
@CoSpinu Our company ran into the exact same issue this week and your solution helped. We brainstormed it and a possible solution could be to delete your Library and Temp folders and your .csproj files and let Unity rebuild them. We are under deadline trying to get a large project converted to WebGL and this rebuilding could take hours on our part. If you have a smaller project, it may be worth testing to see if changing your preprocessor directive back to #if UNITY_ENGINE and rebuilding the project works. I'm sure it will save someone a headache.
Best of luck.
We were eventually able to confirm the suggested solution. Rebuild your Library if it happens again.
Answer by KemojoPtr · Apr 10, 2017 at 07:40 PM
I had the same issue and removing the symbols was not an option. I closed Unity and deleted all of my project and solution files, then did an Xcode replace build and the error went away.
Also make sure that all of your code has properly been migrated. Unity 5.6 deprecated a lot of code and editor scripts don't always show compile errors in the console.
Answer by JianZ · Apr 28, 2017 at 09:45 PM
Got this problem as well, pretty sure all editor stuff guarded correctly with #if UNITY_EDITOR , had anyone report this as a bug to unity? my project size is huge, I found I can't repro the issue when I create a smaller test project
Answer by MarinWebTech · Jun 08, 2017 at 08:47 AM
Having the same issue with Oculus Sample Framework (OVR) for mobile, we get this:
ArgumentException: The Assembly UnityEditor is referenced by Assembly-CSharp ('Library/ScriptAssemblies/Assembly-CSharp.dll'). 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) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:142) UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:179) UnityEditor.HostView:OnGUI()
The file "Assembly-CSharp.dll" is there in the Library, but it is also in the "/TEMP/Staging Area/ " but we removed that and it created it again. We're dead in the water, we have check this on various versions (5.6.0 & 5.6.1), same issues. The file built prior to importing the OVR content.
Ideas? Beuller?? Beuller??
Hello !!
I had the exact same issue as $$anonymous$$arinWebTech had (with Oculus Sample Framework OVR for mobile):
(ArgumentException: The Assembly UnityEditor is referenced by Assembly-CSharp ('Library/ScriptAssemblies/Assembly-CSharp.dll'))
I solved the problem b doing the following (the version of Unity I used was 5.6.2f1):
In the "build settings" windows (ctrl+shift+b), after selecting either "build" or "build and run", a windows appears asking to update the APIs (API Update required). This window has two options: "I made a backup. Go Ahead !" and "No thanks". When selecting "I made a backup. Go Ahead !", the dll problem arises. But, if the option "No thanks" is selected, the project compiles flawlessly !!!
In case the "API update required" doesn't show up when building the app, A backup project needs to be used ins$$anonymous$$d. This is because (i suppose) the current project has already been updated with the new API.
I don't know if this is the right solution (not updating APIs) but it's what worked for me.
Yes, pressing "No Thanks" seems to work. Unity for some reason prompts for API update even if API update was done already...
Your answer
Follow this Question
Related Questions
Unity hangs when opening a project. 0 Answers
What i can do with Type Load Exception Unity3d 0 Answers
Help getting Unite 2017 demo code to run, need to fix errors 0 Answers
different behaviors of the project in unity Editor and smart phone 0 Answers
projects corrupted: Copying assembly.....UnityEngine.TestRunner.dll' failed 2 Answers