c#未能加载文件或程序集“NPOI”或它的某一个依赖项

 

看看依赖的dll是不是全的

我在App.Config文件面的

<dependentAssembly>
        <assemblyIdentity name="NPOI.OpenXmlFormats" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
        <!--<bindingRedirect oldVersion="0.0.0.0-2.5.3.0" newVersion="2.5.3.0" />-->
        <bindingRedirect oldVersion="0.0.0.0-2.5.3.0" newVersion="2.2.1.0" />
        <!--<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />--> </dependentAssembly>

改了之后就好了,主要修改的是newVersion=2.2.1.0。

 

 <bindingRedirect oldVersion="0.0.0.0-2.5.3.0" newVersion="2.2.1.0" />

 上面这句代码意思是,

如果依赖中发现了任何 0.0.0.0-2.5.3.0 区间版本号的 NPOI.OpenXmlFormats 程序集的引用,都将使用 2.2.1.0 版本的。