[英]The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard
[英]NSubstitute -3.x 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard,
我正在努力在我的代碼中找到這個錯誤背后的原因:
ApplicationServiceTests\\Test.cs(29, 13):錯誤 CS0012:類型“ValueType”是在未引用的程序集中定義的。 您必須添加對程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
代碼行是:
repo.GetCoveredCards(Arg.Is(cifCode)).Returns(Task.FromResult(new GetCustomerCCPlusResponse()
{
CreditCardPlus = new[] { card1, card2 }
}));
工具、框架和包
.net 框架 4.6.1 Visual Studio 2015 使用 MSBuild 14。NSubstitute 3.1.0
似乎當我使用 NSubstitute 1.10.0 版時,它運行得非常好。
現在的問題是,為什么使用最新版本的 NSubstitute 會出現此錯誤?
更新 Visual Studio 后我遇到了同樣的問題。 刪除UT工程文件夾中的bin和obj文件夾,重建工程。 那為我修好了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.