Microsoft.Extensions.Logging.Abstractions "could not load file or assembly"
Hello,
I'm facing issues I don't really understand, here is what i did to reproduce the situation. I have created a WindowsFormsControlLibrary (.NET Framework 4.8) project, on my VS 2019 16.8.4. Once my project is created I installed the NLog NuGet packages and wrote a small piece of code to use NLog ( add NLog on my LoggerFactory) At this point, my project runs without any problem, but if I install the Xbim.Common NuGet package, i have this issue : "Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions', Version = 2.1.0.0
Microsoft.Extensions.Logging.Abstractions Version 5.0.0 package is installed.
I'm not really familiar with this kind of issue, do you have any idea where the problem could come from ? I guess there is dependencies to Microsoft Logging in Xbim.Common but why does this rise an issue like this ?
Thanks
There is a mismatch between Microsoft.Extensions.Logging.Abstractions versions in your project.
It looks like there is a dependency to "Microsoft.Extensions.Logging.Abstractions" version 2.1.0.0 in Xbim.Common , but I have this "Microsoft.Extensions.Logging.Abstractions" package installed in version 5 in my project so why is Xbim.Common still looking for the version 2.1.0.0 ?
Yes it is. You can try to use binding redirection.
I tried but without success. I would like to understand why this issue occurs when I install Xbim.Common in a WindowsFormsControlLibrary project and not in a WindowsFormsApp project. My App.config is the same in both cases.
Thanks
I'm sorry, but this issue seems to be based on your specific project structure and is external to xbim toolkit.
I totally understand, but I'm on empty projects and the issue occurs when I install the Xbim NuGet package, that's why I'm trying to understand why is this package causing this problem. I see in the NuGet package manager that Xbim.Common has dependencies to Microsoft.Extensions.Logging.Abstractions version >=2.1.1 and I have the version 5.0. If there anything specific in this Xbim.Common package that can create this kind of issue ?
Most likely, Microsoft has broken backwards compatibility between Microsoft.Extensions.Logging.Abstractions, Version = 2.1.0.0 and Version 5.0.0.0
Might be worth trying this PR which adds net5 support for Essentials https://github.com/xBimTeam/XbimEssentials/pull/359
We'll get this merged shortly, but in the meantime can you target netcore3?
Thank you for your answers, I will have a look at this.