Installed Entity framework SQLite but getting this error in console
how do i fix this message? Im using the wpf template that vs provides by default.
i get this error when i run the command:
dotnet ef migrations add InitialCreate
63 Replies
its saying there is an error in the file: "HHR Essentials.csproj.EntityFrameworkCore.targets"
here its contents:
Can you show your .csproj file?
and sln file
idk where that is
looks like .net framework project
u double click the project icon
and it should open the csproj
please use $paste
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
BlazeBin - qnmewynawhsp
A tool for sharing your source code with the world!
or if ur project is on github that would be easier
Yarp, this is ye olde framework
im running the 4.8 framework
Can we ask why?
Its outdated and dead since 2017
default wpf template when creating
well there is default wpf for .net 8
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
which is the newer one
i picked this when creating
Mhm
You shouldn't have 🙂
restart project?
I would say so, yes
which one do i pick?
??
Yes
the one that does not have "Framework" in the name basically
anything tagged as .net framework means its legacy code now and unless you have a specific requirement that makes u use it, u should avoid it
didnt know, mb
its ok
glad u learned before u progressed too deep into it
can we keep this thread if i face the issue again?
Yup
:kekw: already created 75% of my UI
Make sure you install the correct version of EF thou
You can copy the xaml over
i have .net 8
you could keep it but I strongly suggest you $close this one and open a new one with your specific problem which would be less cluttered for anyone to help u
If you have no further questions, please use /close to mark the forum thread as answered
You'll be fine
i should be fine to use the latest v8 bc i have .net 8?
yep
Yes
bet
u can do dotnet --info
to confirm
if you're unease
If you tried using that with the current project, that's why it's not workinf
EfCore is only for modern .net
Not framework
all good
also
hmm?
https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=visual-studio
might be helpful if u dont already
usually u want
Microsoft.EntityFrameworkCore.Sqlite
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design
if u plan on using migrations
also how do i place the db in the same place as the .exe file when building?
bc when creating and writing its in the /data/.db
if u look at the example in the link above
Just add relative to your root directory, then set it to "copy if newer"
by setting DbPath to simple "blogging.db"
it would do that already
alr thx
so instead of the above just
what Pobiega said above would be the preferable way of doing it because it would persist the information in your db across builds
that does seem easier
This assumes you have data before the app starts for the first time
so it would be mmm I think
DbPath = "../../../blogging.db";
(assuming u dont set the file to copy if newer) if u do u can keep the above instead with just blogging.db)Ie, your project contains a pre-migrated database
If you dont, then just let ef create it
I'd probably recommend just adding a seeder to your app however
wdym by "seeder"
Makes it a lot easier to upgrade without losing data
A method that adds any initial data if the tables are empty after migrations
how do i properly add a sqlite3 database which will store data from an api i have
that is too broad... this explains how u can use SQLite in your application https://discord.com/channels/143867839282020352/1265904711639498753/1265908523305537566
leowest
Quoted by
<@1102729783969861782> from #Installed Entity framework SQLite but getting this error in console (click here)
React with ❌ to remove this embed.
beyond would be u querying your api and storing it to the database