FileNotFoundException: System.Runtime, Version=4.2.2.0
See original GitHub issueDescribe the bug Attempting to run ‘dotnet fm migrate’ on a migration fails with the following exception, if I use a certain option in the migration:
dotnet fm migrate -c "..." -p sqlserver -a Schema.dll
-------------------------------------------------------------------------------
xxx: xxx migrating
-------------------------------------------------------------------------------
Beginning Transaction
Rolling back transaction
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.
at xxx.Schema.xxx.Up()
at FluentMigrator.MigrationBase.GetUpExpressions(IMigrationContext context) in d:\a\1\s\src\FluentMigrator\MigrationBase.cs:line 83
at FluentMigrator.Runner.MigrationRunner.ExecuteMigration(IMigration migration, Action`2 getExpressions) in d:\a\1\s\src\FluentMigrator.Runner\MigrationRunner.cs:line 831
at FluentMigrator.Runner.MigrationRunner.ApplyMigrationUp(IMigrationInfo migrationInfo, Boolean useTransaction) in d:\a\1\s\src\FluentMigrator.Runner\MigrationRunner.cs:line 607
at FluentMigrator.Runner.MigrationRunner.MigrateUp(Int64 targetVersion, Boolean useAutomaticTransactionManagement) in d:\a\1\s\src\FluentMigrator.Runner\MigrationRunner.cs:line 427
at FluentMigrator.Runner.Initialization.TaskExecutor.Execute() in d:\a\1\s\src\FluentMigrator.Runner\Initialization\TaskExecutor.cs:line 165
at FluentMigrator.DotNet.Cli.Commands.BaseCommand.ExecuteMigrations(MigratorOptions options, IConsole console) in d:\a\1\s\src\FluentMigrator.DotNet.Cli\Commands\BaseCommand.cs:line 32
at FluentMigrator.DotNet.Cli.Commands.Migrate.OnExecute(IConsole console) in d:\a\1\s\src\FluentMigrator.DotNet.Cli\Commands\Migrate.cs:line 35
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](IConsole console, String[] args)
at FluentMigrator.DotNet.Cli.Program.Main(String[] args) in d:\a\1\s\src\FluentMigrator.DotNet.Cli\Program.cs:line 35
This is my migration:
public override void Up()
{
Alter.Table("MyTable")
.AddColumn("MyColumn").AsBoolean().SetExistingRowsTo(false);
}
If I remove SetExistingRowsTo
it succeeds. If I try SetDefaultValueTo
the error is also present.
To Reproduce
- Build a .NET Core 3.1 app with the above schema migration and run it
Expected behavior No error to occur, the migration should succeed.
Information (please complete the following information):
- OS: Windows 10
- Platform .NET Core 3.1
- FluentMigrator version: 3.2.6 (
fluentmigrator.dotnet.cli 3.2.6
) andFluentMigrator 3.2.6
used by the schema project - FluentMigrator runner: FluentMigrator.DotNet.Cli
- Database Management System: SQL Server
- Database Management System Version: 2019 LocalDB
Additional context I’ve seen a similar report at https://github.com/fluentmigrator/fluentmigrator/issues/1188 but it was unclear what the resolution is. It’s also interesting the migration fails when using some optional extension methods (eg SetExistingRowsTo) but otherwise works fine.
I have tried adding System.Runtime to my project via nuget but it did not resolve the error.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (1 by maintainers)
Top GitHub Comments
Just an update on this. I released 3.2.7 this morning. There is a small chance we will have a 3.2.8 release as there is an outstanding Oracle PR, but otherwise I am focused on finishing 3.3.0 which should address this problem.
I just ran into this issue today, looking forward to the PR as well. Thank you @jzabroski