-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI Breaks when run against netstandard 2.1 assemblies #1160
Comments
Can you please provide a repro project? These kinds of assembly location issues can be a time sink/nightmare to reproduce without a repro project. There are simply too many knobs to turn associated with assembly location. Note: Using "dotnet publish" by itself to create the migration assembly is not magical. It's the .deps.json file that is created alongside your assembly that is somewhat magical, as it tells the .NET Runtime about your executable's dependencies.
Are you referring to FluentMigrator.DotNet.Cli, or the In Process Runner? If the former, please see #1016 - we suggest using an In-Process Runner when you have this problem. |
I have the same problem, but I couldn't reproduce it with small example project. All I have is a stack trace, maybe this will tell something to you
I'm running migrations from batch
|
@szyb Please see my reply directly above your comment.
A more permanent fix is coming in #1178 The most common way I've run into assembly link-load problem is by referencing System.ComponentModel.Annotations nuget package. What System.* assemblies are you referencing in your erroring project? |
In fact, I have reference to System.ComponentModel.Annotations, however adding it to my small trying-to-be-repro project didn't show any issues with that. |
System.ComponentModel.Annotations is the worst because its OOB and, in my opinion, packaged incorrectly. If you search the dotnet org GitHub, you will find me complaining about this. The problem is the net472 assembly uses a different z in x.y.z version number. This creates a dependency diamond. It is not FluentMigrator's fault that Microsoft packaged System.ComponentModel.Annotations in a way that makes netstandard2.0 unusable for dynamically loaded assemblies, and the ONLY fix for this packaging issue is to use an In-Process Runner. However, the issue I mentioned tries to solve all other problems. I believe .NET 5.0 will not change the 'z' field in the version number across runtimes going forward, after I raised the problems with it, but I have not confirmed. |
Also, note, just adding a package won't necessarily cause problems. It has to be linked to the runtime assembly fluent migrator is walking. |
When running the CLI against a migration assembly that targets netstandard2.1 it fails with the message below. We do use "dotnet publish" to create the migration assembly.
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
The text was updated successfully, but these errors were encountered: