How to detect if my ASP.Core app is running from the ef-core tool in Design time?
I'm running into a weird issue where the
dotnet ef
tool keeps trying to start up my web app, instead of using the DesignTimeDbContextFactory
that is implemented in the same project. This wouldn't be a big issue, but every time I run an ef tool, it dumps a huge StopTheHostException
on the console, because of course it fails to fully load the web app, and this is kind of annoying.
Is there a way to detect if the program was launched by dotnet ef
in my Main()
somehow, so I can skip the web app startup?0 Replies