繁体   English   中英

找不到类型或命名空间名称“NUnit”| 统一

[英]The type or namespace name 'NUnit' could not be found | Unity

我有下一个错误:

The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'UnitySetUpAttribute' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'UnitySetUp' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'TestAttribute' could not be found (are you missing a using directive or an assembly reference?)

更多下一个页面:

在此处输入图像描述

代码: https://pastebin.com/5zTjwPZw

怎么修?

测试代码需要在编辑器下,因此它编译为 Assembly-CSharp-Editor-*.dll 引用了 nunit dll。

我发现这特别令人困惑,因为快速检查 Assembly-CSharp-*.csproj 将显示作为参考列出的 nunit.framework,并且如果您将 msbuild 指向 vscode 中生成的解决方案,它也会构建(同时失败Unity“刷新”)。

更新到 2020.2.3f1 后,我在自定义 package中遇到了同样的问题

对于包(或者如果您正在使用程序集),它们现在似乎强制编辑器的唯一程序集应该在检查器的平台部分中标记为:

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM