How to fix Entity Framework issues with Nx and EF Core #673
Replies: 1 comment 4 replies
-
This is a now-common error, ever since nx-dotnet chose to move the output directory for build intermediaries. The previous folder (following .NET defaults) was Previously, Nx and nx-dotnet would only cache the final build output. Though .NET defaults to storing final output in The solution you provide in your article satisfies the The quick-and-dirty solution is to use the dotnet ef database update --msbuildprojectextensionspath dist/intermediates/{projectRoot}/obj where If typing that flag each time is too cumbersome, then the solution in your article is a step in the right direction. The two lines that should be removed from <BaseIntermediateOutputPath>$(RepoRoot)dist/intermediates/$(ProjectRelativePath)/obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath> Then, the A third possible option is to create a custom generator that automatically adds the It's a shame that Entity Framework does not respect the |
Beta Was this translation helpful? Give feedback.
-
When trying to perform a database update using
dotnet ef database update
I was seeing the following error:Long story short, this was caused by an issue where nx-dotnet forces all projects to be built into a dist folder regardless off whether they're dlls or applications etc. EntityFramework is unable to use the configuration to work out where it should go to read its metadata.
I came up with a solution that works for me and I wrote an article about it here:
https://dev.to/simplifycomplexity/using-entityframework-in-a-nxdotnet-environment-cfb
I hope this helps anyone else who is stuck with this problem as it took me a whole weekend to solve.
Beta Was this translation helpful? Give feedback.
All reactions