首页 > 解决方案 > 无法从终端或管道运行 .net Framework Nunit 项目

问题描述

我有一个 NUnit 项目,它有很多 .NET Framework 类库依赖项,所以项目本身就是一个 .NET Framework。

如果我从 Visual Studio 运行测试,项目运行良好并且测试运行正确。

但是,如果我尝试从终端执行相同操作,dotnet build则会出现很多错误,例如 cli 无法恢复包,因此我无法构建项目,也无法从终端运行测试。

error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'TestFixtureAttribute' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'TestFixture' could not be found (are you missing a using directive or an assembly reference?)

在 Azure Pipelines 上执行此操作时,我也遇到了同样的情况。

有任何想法吗?dotnet cli 和作为 .NET Framework 的项目之间是否存在问题?

谢谢你的帮助!

标签: c#.netnunitazure-pipelines.net-framework-4.8

解决方案


推荐阅读