Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.29k stars 428 forks source link

System.IO.FileLoadException: Could not load file or assembly Microsoft.Extensions.Logging.Abstractions #3477

Open MoraParamesh5b0 opened 11 months ago

MoraParamesh5b0 commented 11 months ago

Hi All

I have integrated the MongoDB to my existing project which is .NET FrameWork 4.8.

I have created a new class library for mongo and referenced to other libraries

But I'm getting error as below in my development hosting environment as below.

Referenced and main startup class library is having Microsoft.Extensions.Logging.Abstractions with 7.0.1 as Latest, but MongoDB.Driver supports Microsoft.Extensions.Logging.Abstractions >= 2.0.0, i tried by changing versions but no luck

and in log its showing versions which i'm not using and i tried with those too...

ERROR LoggingManager [(null)] - System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

at MongoDB.Driver.Core.Configuration.ClusterBuilder.CreateClusterFactory() at MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey) at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey) at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings) at MyprojectMongo.DataRepository.GetMongoDbConnection() in F:\myrepositorypath\DataRepository.cs:line 31 at MyprojectMongo.DataRepository.GetMongoCollectionObject[T](String collectionName) in F:\myrepositorypath\DataRepository.cs:line 25 at DataRepository.GetActivityByTimeForActivity(mymodel inputModel, List1 userIds, MongoQueryConfigOutputModel queryData, LoggedInContext loggedInContext, List1 validationMessages) in F:\myrepositorypath\DataRepository.cs:line 216

reb0rt081 commented 8 months ago

Hi, I am also seeing exactly this very same issue. Could you find a work around or fix?