Unity更新插件提示后the same name nunit.framework unity项目一直不能运行

最近在做一个旧项目,是Unity5,没法升级,但是因为加了一些pack,就死活compile出错了

是C#代码(内部)出错,项目一直跑不起来了

出错的提示是很怪,说unit.framework重复了,这个框架本是C#框架,和unity关系不大,

没法用常规方法定位

未必完全是下面的错误提示,但问题是一样的,都是更新包后莫名出错了

(*其实解决方法就是把多余的package删掉,几乎都是在/Library目录,可放心删除,定位方法如下)

方法一:

工作多年居然不知道解决方法是:有查看update log的方法,特别是下面第二个方法,很好用

我查到的log如下

=== Sun Jan  8 01:52:25 2023

Packages were changed.
Update Mode: mergeDefaultDependencies

The following packages were added:
  [email protected]
  [email protected]
  [email protected]
  [email protected]
  [email protected]
The following packages were updated:
  com.unity.textmeshpro from version 1.4.1 to 3.0.6

网上找的错误提示

===================================

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

方法二:

直接看log的实体。。。。。。。。。。。。。。

发现又是Packagecache的问题(为什么用又呢?)

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.36f1/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll
D:/360Downloads/AquaMan SellMYApp/Library/PackageCache/[email protected]/net35/unity-custom/nunit.framework.dll

猜你喜欢

转载自blog.csdn.net/avi9111/article/details/129414967