c# 使用npoi 导出时报错

使用c# npoi 导出报错如下:

解决办法,检查GEHProcurementSystem.csproj 文件中的SharpZip.1.0.0 与packages.config 中是否一致,如没有,则将其加入到GEHProcurementSystem.csproj 中即可,因为npoi 依赖SharpZip 这个dll.GEHProcurementSystem.csproj 制定到哪里去找对于的dll 文件,SharpZipLib.dll 文件是ICSharpCode.SharpZipLib.dll 的高版本。npoi 2.4.1 依赖的是SharpZipLib.dll 文件,本人看报错一直以为依赖ICSharpCode.SharpZipLib.dll 文件,而ICSharpCode.SharpZipLib.dll的最高版本为0.8.5,引入后,一直报版本引用不一致的问题。

正确配置如下:

  <Reference Include="ICSharpCode.SharpZipLib, Version=1.0.0.999, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
      <HintPath>..\packages\SharpZipLib.1.0.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
      <Private>True</Private>
    </Reference>

猜你喜欢

转载自blog.csdn.net/zh127368zh/article/details/103174169