gpt4 book ai didi

c# - 无法加载文件或程序集 'CsvHelper'(C#、VS2019、CSVHelper)

转载 作者:行者123 更新时间:2023-12-02 02:26:06 25 4
gpt4 key购买 nike

我有一个使用 CSVHelper (v19.0.0) 的类库。我在 VS2019(版本 16.5.5;.NET 4.8.03752)中通过 Nuget 安装了 CSVHelper,并且可以确认该包位于“应该”的位置(基于检查我的项目/依赖项/包)/CSVHelper/properties,显示 C:\Users\[my_name]\.nuget\packages\csvhelper\19.0.0)。 [编辑:我已检查我的[解决方案名称].csproj 文件,发现其中包含 PackageReference Include="CsvHelper"Version="19.0.0"]

但是,当我尝试调用类库中的方法之一时,我收到如下所示的错误消息。

我已经在 Google 上搜索过这个问题,其他人在早期版本的 CSVHelper 中也遇到了同样的问题(例如 https://github.com/JoshClose/CsvHelper/issues/944 ),但他们的解决方案对我不起作用。我尝试过:1)清理和重建解决方案; 2) 删除 CSVHelper,然后通过 Nuget 重新安装; 3) 从我的 C 驱动器上的 .nuget 文件夹中删除所有旧版本的 CSVHelper。问题继续出现。非常感谢您的帮助。

System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'CsvHelper, Version=19.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823' or one of its dependencies. The system cannot find the file specified.

最佳答案

我将回答我自己的问题,而不是删除它,希望它对其他人有帮助。

我通过以下方式“修复”了这个问题:

  1. 手动将 CsvHelper.dll 复制到我的 bin\Debug\netstandard2.0 文件夹项目
  2. 直接添加对该 dll 的引用
  3. 删除 Nuget 对 CsvHelper 的引用

关于c# - 无法加载文件或程序集 'CsvHelper'(C#、VS2019、CSVHelper),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65633914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com