I have a class library which uses
CSVHelper (v19.0.0). I installed
CSVHelper via Nuget in VS2019 (Version 16.5.5; .NET 4.8.03752), and can confirm that the package is where it 'should' be (based on checking my project/dependencies/package/CSVHelper/properties, which shows
C:\Users\[my_name]\.nuget\packages\csvhelper\19.0.0). [EDIT: I have checked my [solution name].csproj file and see that contains
PackageReference Include="CsvHelper" Version="19.0.0"]
However, when I try to call one of the methods in my class library, I get the error message shown below.
I have Googled this and others encountered the same problem with earlier versions of CSVHelper (e.g. https://github.com/JoshClose/CsvHelper/issues/944) but their solutions have not worked for me. I have tried: 1) cleaning and rebuilding the solution; 2) removing CSVHelper then reinstalling via Nuget; and 3) removing all old versions of CSVHelper from the .nuget folder on my C drive. The problem continues to appear. Help would be much appreciated.
System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'CsvHelper, Version=22.214.171.124, Culture=neutral, PublicKeyToken=8c4959082be5c823' or one of its dependencies. The system cannot find the file specified.
I'm going to answer my own question rather than delete it, in the hope that it helps someone else.
I "fixed" this by:
User contributions licensed under CC BY-SA 3.0