1

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: '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)'

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.

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?

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

M005
  • 824
  • 1
  • 9
  • 25
  • Did you try to remove the dll reference and install them through [Nuget](https://www.nuget.org/packages/log4net/) instead? If they support .NET Standard/.NET Core (which they do), they should install the corresponding package. – Luke Vo Mar 14 '19 at 07:24
  • Yes I did it, but still same issue – M005 Mar 14 '19 at 07:38
  • Try uninstall it, remove every Reference you see, and install again. If it is still not working, you will need to show your .csproj file. Also, Clean the Solution, manually delete the `bin` folder too. Also, to further prevent unnecessary problem, remove all dll files that you don't need anymore (as Nuget already download them for you). – Luke Vo Mar 14 '19 at 07:42

1 Answers1

0

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.

M005
  • 824
  • 1
  • 9
  • 25