Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
448 views
in Technique[技术] by (71.8m points)

c# - "Could not load file or assembly Microsoft.Extensions.Logging.Abstractions" in a WindowsFormsControlLibrary project

I have an assembly issue I really don't understand. I'm creating a Windows Forms Control Library (.NET Framework 4.8) project, on my VS 2019 16.8.4. once my project is created I install the NLog NuGet packages : NLog.Extensions.Logging and write a small piece of code to use NLog ( add NLog on my LoggerFactory) that's all. At this point my project runs without any issue.

In my NuGet package manager I can see that I have the "Microsoft.Extensions.Logging.Abstractions" installed on version 2.1.0

After that I download a NuGet from an open source solution (Xbim) who has a dependencie to Microsoft.Extensions.Logging.Abstraction and the installation of this package will update my Microsoft.Extensions.Logging.Abstraction from version 2.1.0 to 2.1.1.

Right after this package installation, if I build and Run my project I have this assembly issue : "Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.1.0.0 ...."

I have checked in my "app.config" file and I see that I have some binding redirection for Microsoft.Extensions.Logging.Abstraction :

      <dependentAssembly>
      <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" 
      publicKeyToken="adb9793829ddae60" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
      </dependentAssembly>

So as I understand the assembly version 2.1.0 would be redirect to version 2.1.1. There is one thing I don't really understand about app.config : Is any package installed in my project supposed to appear in this file ? Looks like this file doesn't affect anything at all.

I'm kind of lost at this stage.

Thanks for any tips.

question from:https://stackoverflow.com/questions/66057315/could-not-load-file-or-assembly-microsoft-extensions-logging-abstractions-in-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...