manaszon

[C#] Problems with EF Core assemblies [SOLVED]

Recommended Posts

Hello everyone!
I've got some errors with references to assemblies, but I've managed to solve the most of them except one with Entity Framework Core.

So, the problem is:

CS0234: The type or namespace name 'EntityFrameworkCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

I added the Microsoft.EntityFrameworkCore.dll reference to my resource, and then restarted the server. I got bunch of this error:

The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

If I keep this reference, then I get just these errors, nothing else. So I decided to delete this reference, and add MySql.Data.EntityFrameworkCore.dll and Microsoft.EntityFrameworkCore.Relational.dll. The results are the following:

CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)

CS0246: The type or namespace name 'DbContextOptionsBuilder' could not be found (are you missing a using directive or an assembly reference?)

CS0246: The type or namespace name 'DbSet<>' could not be found (are you missing a using directive or an assembly reference?)
  
CS0012: The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

I don't know what should I do now. I've never used .NET Core, so if anyone could help me a bit, it would be awasome.
Thanks,
manaszon!

Edited by manaszon

Share this post


Link to post
Share on other sites

There were several problems with my project, but it is solved now thanks to @xForcer.

So, if you have a new project, you will need these packages to use Entity Framework Core:
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Tools
- Pomelo.EntityFrameworkCore.MySql
- Pomelo.EntityFrameworkCore.MySql.Design

You will have to copy the .dll files into RAGEMP\server-files\bridge\runtime folder and into RAGEMP\server-files\bridge\resources\<your resource> folder too. After that you will have to add migrations, and if everything goes well then you are done.

MS DOCS - Migrations (EF core)

Edited by manaszon
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.