VS2022 errors out on a project cloned from Git
I'm getting the below error while trying to launch a project that we're supposed to work on as a group.
We've worked a bit with ASP.NET and VS2022 in general before that, but never adding Git into the mix, and unfortunately this just stops me before I can even do anything.
If I understand correctly from the error, the code is looking for a local database, which doesn't exist. I suppose my question is - how do I make one?
In my previous projects it just kind of created one by itself, I didn't need to fill it up with tables or anything it just appeared-
And no, just adding a new database named accordingly doesn't work either, it then starts throwing errors about individual tables unless those are added also
10 Replies
Your understanding is correct. Are there any migrations in the project?
oh christ the migrations
It completely slipped my mind, I should check that
Yeah, those are what are responsible for making the database schema match the
DbContext
for a collaborative project you should definitely look into the different configuration options for ASP.NET Core like user secrets to keep machine-specific options out of your repository
like which database to connect to
either that or use docker to have a consistent environment on all your dev machines
there were migrations, all I had to do was punch in
Update-Database
and it worked
I feel dumb as hell for not having thought of that earlier, but I also wonder how did I not find that in the hour-or-so I spent googling the issue-
tyvm!
uff yeah probably
I never collaborated with VS2022 so I don't really know what to watch out for and what could break stuff, should probably read up on thatnothing is particularly IDE specific about the process
besides adding VS cache folders to your gitignore (
dotnet new gitignore
already has this)okay I checked the .gitignore, and it seems it's full of default stuff, like ignoring VS-specific stuff like the aforementioned cache folders, so I thiiink I will be alright?
i mean, that's just for VS
you still need to make sure machine-specific files and any private information like passwords aren't committed to the repo
user secrets are an easy way to help with that for ASP.NET Core
Safe storage of app secrets in development in ASP.NET Core
Learn how to store and retrieve sensitive information during the development of an ASP.NET Core app.
will give that a read through, thanks!