mattpm
mattpm

Reputation: 1390

dotnet ef database update Could not load file or assembly 'Microsoft.Extensions.FileProviders.Abstractions

I'm trying to execute the following line from Package Manager Console for a code first, entity framework project that I've just cloned from our TFS server. I'm using VS2017.

I've tried uninstalling and reinstalling the package via nuget etc, but I'm at a loss as to what causes this issue and how to resolve it.

Any help, much appreciated.

dotnet ef database update -c DbContext

The resulting output within the Console is as follows:

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:03.12

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.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.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.EntityFrameworkCore.Design.Internal.StartupInvoker.ConfigureHostServices(IServiceCollection services) at Microsoft.EntityFrameworkCore.Design.Internal.StartupInvoker.ConfigureServices() at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String contentRootPath) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4() at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)

=== Pre-bind state information ===

LOG: DisplayName = Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 (Fully-specified)

LOG: Appbase = file:///C:/Users/johnsmith/Source/Repos/myapp/src/myapp-model/bin/Debug/net452/win7-x64

LOG: Initial PrivatePath = NULL

Calling assembly : Microsoft.AspNetCore.Hosting.Abstractions,

Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60.

LOG: This bind starts in default load context.

LOG: No application configuration file found.

LOG: Using host configuration file:

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.

LOG: Post-policy reference: Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60

LOG: Attempting download of new URL file:///C:/Users/johnsmith/Source/Repos/myapp/src/myapp-model/bin/Debug/net452/win7-x64/Microsoft.Extensions.FileProviders.Abstractions.DLL.

WRN: Comparing the assembly name resulted in the mismatch: Build Number

ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Could not load file or assembly 'Microsoft.Extensions.FileProviders.Abstractions, Version=1.1.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)

Upvotes: 2

Views: 969

Answers (1)

Ash
Ash

Reputation: 2605

Seems like you have this package installed in different projects? Navigate to the Manage NuGet Packages for Solution and search for that package in the consolidate tab. enter image description here

There you will see the package installed in different projects with different versions. Install the appropriate version and it should work.

Search Nuget Package in installed packages

Upvotes: 2

Related Questions