Skip to content
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

With circular dependency, need to LoadFromAssemblyPath #4374

Closed
Tridy opened this issue Jun 7, 2023 · 3 comments
Closed

With circular dependency, need to LoadFromAssemblyPath #4374

Tridy opened this issue Jun 7, 2023 · 3 comments

Comments

@Tridy
Copy link

Tridy commented Jun 7, 2023

in the part with the, If this causes a circular dependency, you can update the base output path of the migrations project instead,

since now the reference is not added from the original project to the migrations project directly (due to the circular dependency), the original project will not know about the migrations project, and migration projects assembly needs to be loaded manually:

AssemblyLoadContext.Default.LoadFromAssemblyPath(migrationDllPath);

Otherwise on the startup the ... x.MigrationsAssembly("MigrationsAssemblyName") will throw an exception that assembly was not found.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@ajcvickers ajcvickers changed the title With curcular dependency, need to LoadFromAssemblyPath With circular dependency, need to LoadFromAssemblyPath Jun 14, 2023
@ajcvickers
Copy link
Contributor

@Tridy Can you post your .sln and .csproj files?

@Tridy
Copy link
Author

Tridy commented Jun 19, 2023

Sure, here it comes.
sln_proj_issue_4374.zip

The Migrations project needs to reference the WebApi project since it is the WebApi project that contains all the domain classes. The Migrations project only contains the migrations, nothing else.

@bricelam
Copy link
Contributor

Duplicate of dotnet/efcore#25023

@bricelam bricelam marked this as a duplicate of dotnet/efcore#25023 Jun 26, 2023
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants