I'm trying to set up our project to re-scaffold the DbContext and all the models before each build in order to catch any database changes within our API. However when I set up the pre-build command and run/build the project, it just spawns a bunch of .NET Host tasks to take up the rest of my CPU and the build stalls forever. So then I have to open task manager and kill Visual Studio 2019.
I'm using VS 2019. This is a .Net Core 3 API with EF Core. Here's an example of the command that I placed in the pre-build. It runs fine in PMC.
dotnet ef dbcontext scaffold "Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models --force --context-dir Data --context APIContext
How do I get this to work as a pre-build event?