Visual Studio 2017类库项目:无法加载文件或程序集System.IO.FileSystem

时间:2017-05-18 02:25:28

标签: c# visual-studio class-library

我正在用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'或其依赖项之一。系统找不到指定的文件。

如何确保类库项目可以找到此库?

由于

1 个答案:

答案 0 :(得分:0)

单击下面的链接以获取步骤的图像

In Visual Studio, Select Tools/NuGet Package Manager/Package Manager Console

enter this at nuget Command Line

这将安装Microsoft的最新System.IO.FileSystem包。