48

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:

enter image description here

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sandaru
  • 1,229
  • 2
  • 21
  • 39

24 Answers24

48
  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
gopinath s
  • 612
  • 6
  • 5
  • 21
    This was already checked for me and it is still not available – Greg Nov 14 '17 at 16:51
  • This answer, combined with @Slauma's answer here (https://stackoverflow.com/questions/11887833/net-data-model-is-shown-as-xml-and-not-as-diagram) fixed it for me. – mattyB Apr 16 '18 at 08:50
  • Note: The "ADO.NET Entity Data Model" option will not appear on a SharedProject – momo Jul 09 '18 at 15:13
  • This answer, combined with https://stackoverflow.com/a/21074053/1662973 fixed it for me. Nuget + EF. – Anthony Horne Aug 20 '18 at 11:16
  • 12
    It was already checked for me and didn't work. However, when I created project "Class Library (.NET Framework)" project instead of "Class Library (.NET Standard)" - ADO option appeared. – Somnium Jan 24 '19 at 01:28
43

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

RezaNikfal
  • 927
  • 11
  • 22
  • [This](https://social.msdn.microsoft.com/Forums/vstudio/en-US/7035edc6-97fc-49ee-8eee-2fa4d040a63b/what-are-differences-between-net-framwork-net-standard-and-net-core?forum=clr) may help you. – RezaNikfal Jan 15 '19 at 17:27
  • This is the right answer! We should add a project using Class Library (.NET Framework) – CincyBella Sep 16 '21 at 19:20
25

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://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

Hope this helps! You're welcome.

dapug
  • 1,781
  • 4
  • 22
  • 28
12

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 enter image description here
  4. Use Empty Template enter image description here
  5. Right click project (not your solution) -> Add -> New Item
  6. Select Data -> ADO.NET Entity Data Model enter image description here
Dan Leksell
  • 510
  • 5
  • 6
7

Tools-->Click Get Tools and Features-->Click on Modify--> Click on Individual components--> Tick the CheckBox of Entity Framework 6 Tools -->click on Modify--> You'll get a pop up window-->click on Retry(if it not closed, Click on Continue)

Now Launch VS and this time check in Data ADO.NET Entity Model will be added.

Please Check this Article http://dotnet-jigyasa.blogspot.com/2018/03/adonet-entity-data-model-missing-visual.html Worked for me.

Sunny
  • 73
  • 1
  • 5
  • Thanks, I had forgotten that the .NET desktop development had not been checked off previously. – Jamie Jan 02 '22 at 14:35
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.

Abror
  • 69
  • 1
  • 1
6

i think you selected class library (.NET Standard) instead of class library (.NET framework), try to select class library (.NET framework) you will get it.

shakeeb
  • 61
  • 1
  • 1
2

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.

2

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.

slfan
  • 8,950
  • 115
  • 65
  • 78
sas
  • 31
  • 4
2

Basically what I found is when you choose .Net Core Project EF not shown under data tab. You need to choose .Net Framework Instead of .Net Core. Then you will find all the stuffs under data tab.

1

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.

Squazz
  • 3,912
  • 7
  • 38
  • 62
Qaisar
  • 11
  • 1
1

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.

1

It is true that this feature is not available in Core and this might not answer the question directly. But Core offers Reverse Engineering command line that I have used successfully for project with existing database.

What you need to do is just run the following command with in your Package Manager Console and it will Generate models for you based on the existing database:

Scaffold-DbContext 'Data Source=.\SQLEXPRESS;Initial Catalog=DbName;Integrated Security=True;MultipleActiveResultSets=True' Microsoft.EntityFrameworkCore.SqlServer

Or directly from command line using dot net.

dotnet ef dbcontext scaffold "Data Source=.\SQLEXPRESS;Initial Catalog=DbName;Integrated Security=True;MultipleActiveResultSets=True" Microsoft.EntityFrameworkCore.SqlServer

To learn more about this feature you can read more at Microsoft page:
https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding

Maytham Fahmi
  • 31,138
  • 14
  • 118
  • 137
  • 1
    Thanks for the hint, actually looking at the link that you have provided, this worked: Step 1: Install-Package Microsoft.EntityFrameworkCore.SqlServer Step 2: Scaffold-DbContext 'Data Source=.\SQLEXPRESS;Initial Catalog=DB;Integrated Security=True;MultipleActiveResultSets=True' Microsoft.EntityFrameworkCore.SqlServer – Amir Dashti Jun 25 '20 at 05:40
0

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.

Adrian
  • 655
  • 6
  • 10
0

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

Hind
  • 333
  • 3
  • 7
0

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.

0

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

stefano
  • 43
  • 5
0

Make sure that you're right - clicking an appropriate project, not the solution.

The respective UIs look almost identical; they even have the same keyboard shortcut. The one from the solution will "miss" the Data tab if you expect it to be there; e.g. from screenshots.

Also make sure, as per previous posts that you have: a. A Project that supports Entity Framework and b. You did have the appropriate tools installed.

0

I was having same problem. In my case, Entity Framework 6 tools and SQL tool options under individual components were already checked. I tried to reinstall with same selected components and this worked for me.

Karthic G
  • 1,162
  • 1
  • 14
  • 31
  • ok, when I additionally checked this and modified VS and it worked for me. It could have worked due to reinstallation with the selected component. – Karthic G May 03 '21 at 08:43
  • I have modified the answer accordingly , reinstallation worked for me which could have repaired the required components as you mentioned – Karthic G May 03 '21 at 08:49
0

If you can't go and create a new project, like me,

and your sure you have the right class library selected, what worked for me was doing a clean and build, then just opening a file from my solution explorer and whalah,

hope it helps this is quite a broad and versatile question

ARITHABORT
  • 11
  • 4
-1
  1. File -> New Project
  2. Select Web -> ASP.NET Web Application (.NET Framework) image 1
  3. Right Click Models -> Add -> New Item (Note: it won't work for other folders like App_Data) image 2
  4. Choose Visual C# Then ADO.NET Entity Data Model image 3
Community
  • 1
  • 1
-1

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

-1

I think you have added "Class Library (.NET Standard)" which is not supporting ADO.net Entity Data Model. You have to add "Class Library (.NET Framework)"

BC TUBE
  • 664
  • 5
  • 15
  • This is a question, not an answer. Please use comments for that. – Gert Arnold Aug 28 '21 at 12:34
  • And you just copied [this answer](https://stackoverflow.com/a/56674558/861716). And [this](https://stackoverflow.com/a/52618354/861716) and [this](https://stackoverflow.com/a/56819105/861716) – Gert Arnold Aug 28 '21 at 17:40
-2

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

grrigore
  • 1,050
  • 1
  • 21
  • 39
Sun
  • 1