错误System.IO.FileLoadException:'.net核心中无法加载文件或程序集'log4net,版本= 2.0.8.0 [英] Error System.IO.FileLoadException: 'Could not load file or assembly 'log4net, Version=2.0.8.0 in .NET Core

查看:91
本文介绍了错误System.IO.FileLoadException:'.net核心中无法加载文件或程序集'log4net,版本= 2.0.8.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将旧的.NET 4.5.2控制台应用程序迁移到.NET Core,所有代码都已成功编译,但是在执行控制台应用程序时出现以下错误

I am doing migration my old .NET 4.5.2 console application to .NET Core, all the code is getting compile successfully but while executing console application I am getting following error

System.IO.FileLoadException:'无法加载文件或程序集'log4net,版本= 2.0.8.0,区域性=中性,PublicKeyToken = 669e0ddf0bb1aa2a'.找到的程序集的清单定义与程序集引用不匹配.(来自HRESULT的异常:0x80131040)'

System.IO.FileLoadException: 'Could not load file or assembly 'log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

在我的控制台应用程序中,只有很少的第三方dll和内部dll被引用,它们是在.NET 4.5.2框架上构建的.

In my console application there are few third party dlls along with our internal dlls are referenced which are build on .NET 4.5.2 framework.

甚至问题在于,在进入我的项目调试模式之前,由于该错误,我无法调试代码以查找导致该问题的程序集.

Even problem is that before enter my project debug mode, this error has been thrown out due to this I am unable to debug code to find that which assembly is causing this issue.

我是否需要将所有内部dll以及第三方dll迁移到控制台应用程序中引用的.NET Core中?

Do I need to migrate my all internal dlls as well as third party dlls into .NET core which are referenced into my console application?

我知道对此问题有很多疑问,但是这些问题与.NET Framework 4.5.*有关,但是对于将现有的.NET 4.5.2迁移到.NET Core我没有任何解决方案

I know there are many question has been asked for this problem, but these questions are related to .NET framework 4.5.* but I didn't get any solution for migration existing .NET 4.5.2 to .NET Core

推荐答案

最后,我遇到了一个问题.问题是log4net.dll没有从该位置(即C:\ Users \ User.nuget \ packages \ log4net \ 2.0.8 \ lib \ netstandard1.3)复制到bin/debug文件夹.我已经手动复制了此文件,它开始工作.

Finally I got an issue. The problem was that log4net.dll was not getting copied from this location (i.e. C:\Users\User.nuget\packages\log4net\2.0.8\lib\netstandard1.3) to bin/debug folder. I have manually copied this file and it started working.

现在,我需要查看为什么未复制此文件.

Now I need to see why this file was not getting copied.

这篇关于错误System.IO.FileLoadException:'.net核心中无法加载文件或程序集'log4net,版本= 2.0.8.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆