PrecompiledAssemblyException error
Hi there, I'm relatively new to Unity and want to learn C#. I'm trying out some tutorials that already have some assets prepared from the asset store. However, I keep getting the following error over 20 times:
PrecompiledAssemblyException: Multiple precompiled assemblies with the same name nunit.framework.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths: C:/Program Files/Unity/Hub/Editor/2018.4.28f1/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll D:/Unity Projects/Tutorial Lesson 1/Library/PackageCache/com.unity.ext.nunit@1.0.0/net35/unity-custom/nunit.framework.dll UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ValidateAndGetNameToPrecompiledAssembly (UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssemblies) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorBuildRules.cs:569) UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.ToScriptAssemblies (System.Collections.Generic.IDictionary`2[TKey,TValue] targetAssemblies, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+CompilationAssemblies assemblies, System.Collections.Generic.HashSet`1[T] runUpdaterAssemblies) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorBuildRules.cs:581) UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.GetAllScriptAssemblies (System.Collections.Generic.IEnumerable`1[T] allSourceFiles, System.String projectDirectory, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+CompilationAssemblies assemblies, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssemblyType onlyIncludeType) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorBuildRules.cs:328) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] unityAssembliesArg, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] precompiledAssembliesArg) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1538) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1516) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.DeleteUnusedAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:796) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly[]& notCompiledTargetAssemblies, System.String[]& notCompiledScripts) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:993) UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:952) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+c_AnonStorey3.<>m_0 () (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:283) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[T] (System.Func`1[TResult] func, T returnValue) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:104) UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:CompileScripts(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:283)
I've been trying to delete some of the duplicates but naturally everything in library gets replaced after restarting Unity and when I delete anything outside of the project folder I get errors on Unity not being able to find the right file. Is there any solution for something like this?
Answer by prakyath_unity · Dec 23, 2020 at 05:18 AM
Edit->Preferences->External Tool->Gradle Installed with Unity Try Restarting the Unity
Answer by zereda-games · Dec 23, 2020 at 11:26 AM
"PrecompiledAssemblyException: Multiple precompiled assemblies with the same name nunit.framework.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths: C:/Program Files/Unity/Hub/Editor/2018.4.28f1/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll D:/Unity Projects/Tutorial Lesson 1/Library/PackageCache/com.unity.ext.nunit@1.0.0/net35/unity-custom/nunit.framework.dll "
_
This is your error and the rest is just how unity got to that point. so looks to me like you have more then 1 full copy of as package each containing the same .dll file. remove the duplicate packages if it auto loads them again or try to start a new project and only pull in what you actually need until you get to the point in the tutorials that require those scripts and dll's worth a test try. i do this any time i have weird buggy compiling errors and such. some times it's easier just to figure out where the main first error is then work them out from there. sometimes its just one reference in many codes causing the same error over and over.
I will add if the package you are importing is not designed for the unity version you are running their might be existing codes in a newer version of unity then an old package tutorial.
Answer by Brady · Jul 08, 2021 at 12:01 PM
I ran into this same issue with a new project. It was a project that was on one version (2019.4.28f1) which I then down-graded to an earlier version (2018.4.36f1), which is when the issue arose. I wound up deleting the entire project and starting fresh with 2018.4.36f1 to begin with and the issue went away. So unfortunately I don't have a suggested solution for existing projects. However, this does point to the idea that it may be something held over from the previous version of the editor that was used to work on the project. I tried deleting the Library folder and reimporting everything, thinking that might get rid of any such hold-overs. But unfortunately that didn't fix it. The problem hides elsewhere or somewhere deeper. Hope that helps push us toward an answer.
Answer by yalizak · Dec 12, 2021 at 12:29 PM
I deleted something in the project that apparently duplicated in the transition between versions and the problem passed, try to get into safe mode