Can't find ADO.net Entity Data Model template

2019-01-09 10:03发布

问题:

I was trying to create an ASP.NET MVC web application in Visual Studio 2017. I need to take an EF database-first approach for the work.

Unfortunately I can't find the ADO.NET Entity Data Model template in my "Data" template folder:

I have tried following suggestions which didn't work for me.

  1. Installing Entity Framework 6.x via NuGet
  2. Installing package manually by double clicking latest msi file
  3. Changing .NET version from 4.6.x to 3.5

NOTE: I have VS 2015 and VS 2017 both installed on my machine. Only VS 2017 has the problem.

I have created the ASP.NET MVC project as follows:

File -> New -> Project -> Web -> ASP.NET Web Application (.NET Framework) -> MVC

Does anyone know a solution for this problem?

回答1:

  1. Go to Tools -> Get Tools and features
  2. Select Individual components tab and check Entity Framework 6 tools under SDK's, libraries, and framework section


回答2:

For those of you trying the other solutions and still not seeing the templates...

Perhaps you are attempting to add ADO EF to a .NET Core 2.0 project, and EF is not supported out of the box.

You have 2 options:

  1. Install Core 2.0 SDK and NuGet that is aware of .NET Standard 2.0
  2. Use a .NET 4.x project rather than Core

I recommend #1. VS 2017 doesn't actually have the full Core 2.0 SDK installed, nor is it available from the VS installer (which many comments here struggle with).

I know, confusing, right?

From Microsoft:

"You will need to download and install a version of the .NET Core 2.0 SDK that is appropriate to your platform. This is true even if you have installed Visual Studio 2017 version 15.3."

"In order to use EF Core 2.0 or any other .NET Standard 2.0 library with a .NET platforms besides .NET Core 2.0 (e.g. with .NET Framework 4.6.1 or greater) you will need a version of NuGet that is aware of the .NET Standard 2.0 and its compatible frameworks"

https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-entity-framework-core-2-0/

Now... got all that installed and still not seeing the ADO template? I believe that is because it is deprecated/obsolete. This is the way to get EF working in .NET Core: https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

Hope this helps! You're welcome.



回答3:

I had to create a new project using .Net 4.5.2 then I was able to add the ADO.NET Entity Data Model.

  1. File -> New Project
  2. Select Web -> ASP.NET Web Application (.NET Framework)
  3. Set Framework at bottom of window to .NET Framework 4.5.2
  4. Use Empty Template
  5. Right click solution -> Add -> New Item
  6. Select Data -> ADO.NET Entity Data Model


回答4:

It seems you added "Class Library (.NET Standard)" which is not supporting ADO.net Entity Data Model. You may add "Class Library (.NET Framework)"



回答5:

To solve above problem you can modify Visual Studio 2017.You can follow these steps.

  1. Go to Control Panel\Programs\Programs and Features of your computer.

  2. Select Microsoft Visual Studio 2017, right click on it and change.

  3. It will goes to Visual Studio Products window and now click on modify button.

  4. Now tick ASP.Net and web development workload in Web & Cloud section and modify it.

  5. Finally launch Visual Studio 2017.



回答6:

Not a solution as such, but check that the project you've added is for .NET Framework and not .NET Standard. The templates for adding things such as ADO.NET Entity Data Model are included for .NET Framework.



回答7:

Your tools for EF are missing. You need to run the installer again and from "select package" you need to select enitityframeworktools to get the required options in your project.



回答8:

I was having the same problem in VS2017 Community Edition. I had previously tried following but none worked:

  • Installed new feature for "SQL Server Data Tools".
  • Installed NuGet Libraries.

In the end upon closer investigation I had targeted the wrong
See Image: you should be selected .NET Framework instead of .NET Standard

For me changed to the correct project type while Targeting ".NET framework" instead of ".NET Standard" worked.



回答9:

Visual Studio displays available projects according to the area where you clicked. Right Click on the project's name root -> add -> new item -> Data you will be able to select ADO.NET Entity Data Model



回答10:

My solution was to copy an "edmx" file from another project to the project with asp.net core, and works perfect, with all the funtions, the problem is only in the templates availables in the list.



回答11:

in my case ,I had used ADO .NET before so I knew it was installed ..so I just typed ADO in the search box on the upper right corner , and THERE it was , SOLVED ! hope this helps



回答12:

i my case my project->properties->target framework was 2.0, i change to 4.5 and know it works know i see the ado.net entity data model.



回答13:

First change framwork into 4.5.2 in your project application property.enter image description here Just right-click on your application(not project solution) in solution explorer and select Add menu and select ADO.Net under Add Menu. Do whatever you want with ADO.NET. Good Luck.



回答14:

  1. Go to Visual Studio 2017 Tools Menu => Click Get Tools and Features.
  2. Expand More Drop down => Click on Modify.
  3. Click on Individual components.
  4. Choose Entity Framework 6 tools underSDK's, libraries, and frameworks => Click on Modify


回答15:

  1. File -> New Project
  2. Select Web -> ASP.NET Web Application (.NET Framework) image 1
  3. Right Click Moduls -> Add -> New Item image 2
  4. Choose Visual C# Then ADO.NET Entity Data Model image 3


回答16:

Just simply open Visual studio setup. If you already installed choose to modify section and tick .NET desktop development option and install it.