unity 升级错误

字数 294阅读 307

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name Mono.Cecil.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly path: {0}
UnityEditor.Scripting.ScriptCompilation.EditorBuildRules.CreateTargetAssemblies (System.Collections.Generic.IEnumerable1[T] customScriptAssemblies, System.Collections.Generic.IEnumerable1[T] precompiledAssemblies) (at D:/unity/Editor/Mono/Scripting/ScriptCompilation/EditorBuildRules.cs:221)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.UpdateCustomTargetAssemblies () (at D:/unity/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:672)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.SetAllCustomScriptAssemblyJsonContents (System.String[] paths, System.String[] contents, System.String[] guids) (at D:/unity/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:892)
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.SetAllCustomScriptAssemblyJsonContents (System.String[] allAssemblyJsonPaths, System.String[] allAssemblyJsonContents, System.String[] guids) (at D:/unity/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:241)

解决方案如下

1:打开packages manager ,在window->packages Manager。然后把能升级的package 都升级了。应该就解决了

如果找不到Packages Manager
2: (1) 打开项目目录下的 Logs->Packages-Update.log。 看看都更新了什么package。
(2) 打开项目目录下的Packages->manifest.json。 备份里面的内容,然后删除unity升级时加的package。
(3)重启unity,这个时候错误应该消失了。
(4)打开packages manager ,在window->packages Manager。然后把能升级的package 都升级了。
(5)把第二部删除的package添加回来
(6)重启unity

推荐阅读更多精彩内容