C
C#3mo ago
gio735

EF-Core unable to create migration

I'm trying to crate migration, but every single time I get this error. Startup project is set and in package manager project with DbContext is selected too. Haven't changed anything significant that I could think of since last migration. DbContext https://codeshare.io/k0zVX3 Method to add DbContext https://codeshare.io/0bPKZl Program class https://codeshare.io/g8M7kR (didn't copy fully since rest is not related to database) AddServices() https://codeshare.io/MkwOKQ
No description
10 Replies
Salman
Salman3mo ago
Check if you're getting the connection string right , like if the builder is fetching it properly There's also an exception being thrown related to the Hosting Package
gio735
gio735OP3mo ago
it works just fine when I run code normally, I tried to hardcode connection string as well, but it's same. why might it throw such exception?
Salman
Salman3mo ago
can you reinstall that package ? and see
gio735
gio735OP3mo ago
Microsoft.Extensions.Hosting?
Salman
Salman3mo ago
yeah
Salman
Salman3mo ago
Stack Overflow
An error occurred while accessing the Microsoft.Extensions.Hosting ...
I don't understand what wrong. I tried to make a simple crud in .net core mvc with a very simple model which has few fields. These are my models: public class Employee { [Key] publi...
Salman
Salman3mo ago
I hope you'll find solution in this thread as you're having the same problem
gio735
gio735OP3mo ago
I think it's built in thanks will check it
Salman
Salman3mo ago
yup try the solutions in that thread and then let us know
gio735
gio735OP3mo ago
just got home and it worked, but I just don't understand why it stopped working the way it was, also for update-database instead of package manager just ran code normally so context.Database.Migrate(); could do the work and it did just fine. Any idea what could cause it?
Want results from more Discord servers?
Add your server