none
Unable to install EntityFramework in Visual Studio 2017 .Net Core Project RRS feed

  • Question

  • Hello

    I am unable to install EntityFramework in Visual Studio 2017 Professional .Net Core Project. But it works fine with Windows form application and console applications. Could you please help to resolve this issue?

    Thanks in advance

    Best Regards

    Jose

    Sunday, July 9, 2017 6:37 PM

Answers

  • Hi s251984,

    >>I am unable to install EntityFramework in Visual Studio 2017 Professional .Net Core Project. But it works fine with Windows form application and console applications. Could you please help to resolve this issue?

    According your description, it seems that you want to use entity framework 6 in .net core project. but use Entity Framework 6, your project has to compile against .NET Framework, as Entity Framework 6 does not support .NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core

    If your project is an asp.net core application, the recommended way to use Entity Framework 6 in an ASP.NET Core application is to put the EF6 context and model classes in a class library project that targets the full framework. Add a reference to the class library from the ASP.NET Core project.

    For more information, please refer to:

    https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by s251984 Tuesday, July 18, 2017 6:49 PM
    Monday, July 10, 2017 5:25 AM
    Moderator

All replies

  • Hello

    I am unable to install EntityFramework in Visual Studio 2017 Professional .Net Core Project. But it works fine with Windows form application and console applications. Could you please help to resolve this issue?

    Thanks in advance

    Best Regards

    Jose

    Well, when you installed EF for the Windows and console programs, the EF configuration information was put into the app.config and the EF config information could be found by .NET, because any project that create an exe is a root project.

    There is also the root Web.config for a Web program where .NET will look for any configuration information. With that being said, I suspect that this .NET Core is really a classlib project where you installed EF and an app.config was made at the project level that holds EF configuration. All information in app.configs that are subordinate projects to the root project must have their app.config information copied to the app.config in the root project so that .NET can find the configuration information.

    Note: That upon the successful build of a project that creates an exe and the project has an app.config in it, then VS will copy the app.config information to a runtime config file named programname.exe.config where .NET looks for the config information. The exe.config should be sitting in the Bin folder were the programname.exe is located, and both files must be deployed to the same location so .NET can find the config information.

    Sunday, July 9, 2017 11:34 PM
  • Hi s251984,

    >>I am unable to install EntityFramework in Visual Studio 2017 Professional .Net Core Project. But it works fine with Windows form application and console applications. Could you please help to resolve this issue?

    According your description, it seems that you want to use entity framework 6 in .net core project. but use Entity Framework 6, your project has to compile against .NET Framework, as Entity Framework 6 does not support .NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core

    If your project is an asp.net core application, the recommended way to use Entity Framework 6 in an ASP.NET Core application is to put the EF6 context and model classes in a class library project that targets the full framework. Add a reference to the class library from the ASP.NET Core project.

    For more information, please refer to:

    https://docs.microsoft.com/en-us/aspnet/core/data/entity-framework-6

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by s251984 Tuesday, July 18, 2017 6:49 PM
    Monday, July 10, 2017 5:25 AM
    Moderator
  • hello i installed entityframework.tools.dotnet version 2.0.0 offline by pm

    download microsoft.entityframework.tools.dotnet 2.0.0 from nuget.org and go to tools >option > and nuget package manager and update address of path and ok and

     <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
      </ItemGroup>add this code to (ritgh click on proje file and go to .proje ).

    then into cmd cd <proje address>

    enter

    and write :dir

    and enter

    and write dotnet ef

    and enter   end.

    • Edited by mehdimdev Thursday, June 14, 2018 8:44 AM
    Thursday, June 14, 2018 8:31 AM