question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Website cannot load Microsoft.EntityFrameworkCore

See original GitHub issue

I have an API-only site (no pages) that is terminating as soon as it starts.

I found the following errors in Event Viewer.

Application: w3wp.exe
CoreCLR Version: 6.0.21.52210
.NET Version: 6.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at Program.<Main>$(String[] args)

And…

Application '/LM/W3SVC/18/ROOT' with physical root 'C:\inetpub\wwwroot\tt.railtrax.com\' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
   at Program.<Main>$(String[] args)

When I look at Microsoft.EntityFrameworkCore.dll in my deploy folder, it appears to be version 6.0.21.

Microsoft.EntityFrameworkCore.dll

Package Manager says I have 6.0.1 installed. So I don’t know why I have 6.0.21, or if it should work with that version.

Microsoft.EntityFrameworkCore Package

The project runs fine on my own computer. I very recently upgraded all the suggested packages in Package Manager. I assume it happened as a result of that. Do these version discrepancies matter? What else I could try to resolve this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SoftCircuitscommented, Dec 20, 2021

@GoodBoyAlex Were you able to resolve your issue? I just figured it out here. I just deleted the bin and obj folders for all projects involved and rebuilt everything. Now it works.

1reaction
rojicommented, Dec 17, 2021

@SoftCircuits this looks like some sort of deployment issue. There’s very little info on how your website is hosted or how you’re deploying your application to the production server, but the exception says that the Entity Framework Core assembly (DLL) is missing. There’s not much we can do to help with that, but if you manage to reproduce the problem with a code sample, we can investigate further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dll - Could not load file or assembly 'Microsoft. ...
I have deleted local Nuget repository and now I get this error: Could not find a part of the path 'C:\Users\Admin\. · Try...
Read more >
Could not load file or assembly class library " ...
When I run the application, I receive the error: Could not load file or assembly class library "Microsoft.EntityFrameworkCore version = 6.0 ...
Read more >
'EntityFramework.Core.Tools' nuget package installation error
Tools' nuget package installation error: "The process cannot access the file ef.exe because it is being used by another process".
Read more >
Getting error while scaffolding - Microsoft Q&A
EntityFrameworkCore.Tools. Uninstall-Package Microsoft.EntityFrameworkCore.Tools and Reinstall the package. PM> Install-Package Microsoft.
Read more >
Installing Entity Framework Core - EF Core
From the Visual Studio menu, select Project > Manage NuGet Packages · Click on the Browse or the Updates tab · To install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found