Could not load assembly
See original GitHub issue.NET Core 2.1.4 on macOS
dotnet publish
dotnet fm validate versions --processor Postgres --assembly bin/Debug/netcoreapp2.0/api.dll --profile Debug --no-connection
Error
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at System.Linq.Enumerable.<SelectManyIterator>d__167`3.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at FluentMigrator.Runner.MaintenanceLoader..ctor(IAssemblyCollection assemblyCollection, IEnumerable`1 tags, IMigrationRunnerConventions conventions) in Z:\buildAgent\work\89282cfb76b17ca5\src\FluentMigrator.Runner\MaintenanceLoader.cs:line 37
at FluentMigrator.Runner.MigrationRunner..ctor(IAssemblyCollection assemblies, IRunnerContext runnerContext, IMigrationProcessor processor, IVersionTableMetaData versionTableMetaData, IMigrationRunnerConventions migrationRunnerConventions) in Z:\buildAgent\work\89282cfb76b17ca5\src\FluentMigrator.Runner\MigrationRunner.cs:line 101
at FluentMigrator.Runner.Initialization.TaskExecutor.Initialize() in Z:\buildAgent\work\89282cfb76b17ca5\src\FluentMigrator.Runner\Initialization\TaskExecutor.cs:line 85
at FluentMigrator.Runner.Initialization.TaskExecutor.Execute() in Z:\buildAgent\work\89282cfb76b17ca5\src\FluentMigrator.Runner\Initialization\TaskExecutor.cs:line 90
at FluentMigrator.DotNet.Cli.Commands.BaseCommand.ExecuteMigrations(MigratorOptions options, IConsole console)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 86
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<OnExecute>d__1.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 64
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\projects\commandlineutils\src\CommandLineUtils\Conventions\ExecuteMethodConvention.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.<OnExecute>b__0() in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.cs:line 505
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context) in C:\projects\commandlineutils\src\CommandLineUtils\CommandLineApplication.Execute.cs:line 31
at FluentMigrator.DotNet.Cli.Program.Main(String[] args)
I’ve tried 2.0.5 and 2.0.7 of all FluentMigrator packages, no difference.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Could not load file or assembly or one of its dependencies
At 99% the Could not load file or assembly or one of its dependencies problem is caused by dependencies! I suggest you follow...
Read more >How to resolve “Could not load file or assembly … or one of its ...
More often the first step — the assembly is not found matching the version. Then after building the project there would be one...
Read more >Could not load file or assembly
In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were...
Read more >"Could not load file or assembly" when trying to enter ...
Please first try to right-click your project > Unload Project > right-click it again > Reload Project and check if this error disappears....
Read more >Could Not Load File Or Assembly 'System.Runtime, ...
Right-click on the project and select Properties. · In the Properties window, select the Application tab. · In the Target Framework dropdown, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fubar-coder tried to do like in that example, now it works. Thanks again!
It seems that you cannot use the
dotnet-fm
tool due to its restrictions. Some of those restrictions will be lifted as soon as the .NET Core global tools are available (and when we support it).This problem isn’t easily solvable - especially on MacOS. The easiest solution would be to call the runner from within your application instead of using an external tool. You can find an example in this repository.
The runner itself contains several methods for up/down migrations and validation.