我正在开发一个 .C# 中的 NETStandard 类库,然后使用 .NET Framework 单元测试项目对其进行测试。代码的问题行是;
using System.IO;
/*
* Returns true if @strFile points to a file on the system,
* Otherwise Returns False
*
*/
private Boolean checkFileExists(string strFile)
{
return File.Exists(strFile);
}
它抛出异常:System.IO.FileNotFoundException:无法加载文件或程序集"System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'或其依赖项之一。系统找不到指定的文件。
如何确保类库项目可以找到此库?
谢谢
单击下面的链接查看步骤的图像
在 Visual Studio 中,选择"工具"/"NuGet 包管理器"/"包管理器控制台">
在 nuget 命令行中输入此内容
这将从Microsoft安装最新的System.IO.FileSystem Package。