我在我的VS2019测试项目(MSTest)中添加了RestSharp nuget包
执行测试时抛出以下错误。
Message:
Test method RestSharp.UnitTest1.TestMethod1 threw exception:
System.IO.FileNotFoundException: Could not load file or assembly 'RestSharp, Version=106.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75' or one of its dependencies. The system cannot find the file specified.
.Net框架4.8,RestSharp = 106.11.4
可能的问题是什么?
下面是添加到解决方案中的包
发布于 2020-07-11 04:53:08
我猜您只将nuget包添加到主项目中,而不是添加到测试项目中。如果不是这样,请检查解决方案中的所有app.config
和web.config
文件,并查看是否有RestSharp anywhere的<dependentAssembly>
条目。如果有,请尝试将其删除。当然,在确定所有项目都引用了相同版本的RestSharp nuget包之后,再执行此操作。还要确保它们没有直接从不同的位置引用DLL文件。
发布于 2020-08-07 15:13:42
在您的TEst项目中手动应用,如“添加引用”,然后在驱动器中浏览。大多数情况下,您将在Package文件夹中获得此程序集。
https://stackoverflow.com/questions/62840911
复制相似问题