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.

Can't run migrations, Could not load file or assembly 'System.Runtime, Version=4.2.2.0'

See original GitHub issue

Describe the question Hey everyone. I’ve written few migrations in my project. It’s a .NET Core Class Library project. I’ve added FluentMigrator 3.2.15 and FluentMigrator.Runner 3.1.15 nugget packages to it. When I’m trying to run these migrations using dotnet cli like so:

dotnet fm migrate -p sqlserver -c "data source=localhost;initial catalog=MyDb;persist security info=True;Integrated Security=SSPI" -a ".\bin\Debug\netcoreapp3.1\myProject.DB.dll"

it builds VersionInfo table, but when it starts running one of my migrations it throws an error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Not sure if this is a bug or i am doing something wrong…

Information (please complete the following information):

  • OS: Windows 10
  • Platform: .NET 5, .NET Core 3.x
  • FluentMigrator version: 3.2.15
  • Database Management System: MsSQL
  • Database Management System Version: 2018

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jzabroskicommented, Feb 22, 2021

Please see: https://github.com/fluentmigrator/fluentmigrator/releases/tag/v3.2.15

Use --allowDirtyAssemblies

We need to update https://github.com/fluentmigrator/documentation to mention this flag. Come to think of it, we probably should catch unhandled exceptions and see if it’s an exception of this type System.IO.FileNotFoundException where Message starts with "Could not load file or assembly 'System.Runtime" - if you’d like to add a PR for that, that would be great! The unhandled exception handler should throw once it prints a message communicating to consider using this workaround.

0reactions
jzabroskicommented, Jan 20, 2022

@rom5jp Thanks for opening a separate ticket regarding this. I will hide your response in this thread and lock this thread, to avoid future confusion from other Googlers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load file or assembly 'System.Runtime, Version= ...
I tried to run the code using ctrl + f5. That's when I encountered: Could not load file or assembly 'System.Runtime, Version=5.0 ...
Read more >
NET Core: Could not load file or assembly 'System. ...
I am however running into a new issue pulling in the nuget package Microsoft.AspNet.WebApi.Client 5.2.4, but this would be a separate issue.
Read more >
MSB3277: Found conflicts between different versions of ' ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
System.IO.FileNotFoundException: 'Could not load file or ...
I have an application in .net core. the application was running fine, but the error started coming after I installed.
Read more >
Version History - Documentation for GleamTech products
EnsureAssemblies cached (run-once) and called it first in AddGleamTech rather than in UseGleamTech to prevent "Could not load file or assembly" errors when ......
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