30

The strange thing is, it was working fine a few days ago. I added a new column to a table and was going to update the model through the designer and now it says "The Entity Data Model Designer is unable to display the file you requested. You can edit the model using the XML Editor."

There's nothing particularly noteworthy about the new field, it's just a non nullable bit field in SQL Server 2008.

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
Legion
  • 3,922
  • 8
  • 51
  • 95

18 Answers18

28

FOR Visual Studio 2017, 2019

I searched for the solution but come up with the installation of some NUGET packages and Extensions, nothing worked out.

Solution (Missing Entity Framework on Visual Studio)

  1. I searched for Visual Studio Installer on my machine and opened it.
  2. Under Visual Studio Professional 2017.
  3. I clicked on More to see more options. I selected Modify
  4. Select Individual Components (Second Tab)
  5. Check Entity Framework Under SDKs, libraries, and framework
  6. and then click Modify EDMX file will open after the process gets completed.
Charlie
  • 4,827
  • 2
  • 31
  • 55
14

This has happened to me a few times, usually when pulling a solution out of subversion. Rebuilding the project has always fixed the issue for me.

Dmass
  • 141
  • 1
  • 2
  • 3
    This was the cause for me too -- I think the reason is that EntityFramework is a nuget package, and we exclude the packages/ directory from source control (because it's binaries that just get-redownloaded anyway). A rebuild causes all the packages to get downloaded, which makes the EntityFramework dlls and such available. – Felix Mar 01 '16 at 23:29
  • 1
    Exactly what happened to me – CodeMilian Sep 22 '16 at 20:45
  • This solved the problem for me because I made a mistake manually resolving Git merge conflicts, resulting in an orphaned `` tag. The build found the error for me. Thanks! – OutstandingBill Mar 17 '21 at 23:26
11

I also encounter that annoying screen. No, I do NOT want to edit my model in XML... I want the pretty designer! In my case I added a table which did not have a primary key. To fix...

  1. Open the edmx in XML

  2. Delete the erroneous table. It should be well defined with an "<-- ERROR" comment.

  3. Clean and Rebuild.

  4. Close and re-open Visual Studio (yes, it's annoying but necessary)

  5. Rebuild one more time, then open your edmx file. Should open the designer fine.

Hope this helps.

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
Ashley
  • 179
  • 2
  • 9
  • I liked the "annoying but necessary".. Welcome to SO. – Alejandro Montilla Oct 20 '17 at 17:06
  • 1
    hahaha.. Thanks. :) Happy to FINALLY be able to help. I've searched SO for years. Finding good, solid answers for Entity Framework has been my first real contribution. :) – Ashley Oct 20 '17 at 18:38
  • Remember that answering is not the only way you could help, also voting, commenting, review queues. You still dont have the reputation for those accions, but keep the good work and you will get there in no time. :) – Alejandro Montilla Oct 20 '17 at 18:47
  • Wasn't precisely my solution; instead of comments I had Intellisense alerting me to issues with my XML. After cleaning up those issues I was able to view the `edmx` again. Had to close and re-open the XML several times in order to refresh the Intellisense and see the latest break, but got it working – MichaelM Jul 03 '19 at 18:50
  • Opened the XML file and found some merge errors from SVN. Worked for me, without having to restart or rebuild. Thanks for pointing out the XML. – Kevin Amorim Apr 01 '20 at 10:57
7

Fixed by deleting the file and regenerating it.

Legion
  • 3,922
  • 8
  • 51
  • 95
5

This happens to us quite a bit (usually from a bad merge) and our EDMX file is over 50k lines, which makes eyeballing the problem impossible. However, firstly, you can use one of the online XML parsers (eg. https://onlinexmltools.com/validate-xml) to determine if the XML is correct. Once the XML is valid, the file should at least open in the XML editor (I assume you are using Visual Studio): you can then use Alt+PageDn (Edit > Goto > Next Issue) - the wiggly underscore and associated tip are often of genuine help. I have managed to resurrect our EDMX several times this way.

Fireman Sam
  • 121
  • 1
  • 3
3

In Visual Studio 2019 I could solve the problem by opening the .edmx file using the built-in XML editor.

Visual Studio shows the error(s) underlined like this:

enter image description here

Check the Error List window (red X icon)...

Once you get rid of all errors, then the designer will show as expected.

Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480
2

This happened to me when I added a field to an table that was used in a function as RETURN (SELECT TableName.* .... )

The CollectionSet subnode of the ReturnType node for that function in the EDMX wasn't refreshed.

To fix it, you need to simply run ALTER FUNCTION (without actually changing it), then update the model from database within Visual Studio.

Edgar
  • 473
  • 1
  • 5
  • 19
1

Just had a similar problem: nothing in the designer window.

Double clicking each of the entities in the model browser made them re-appear.

Richard Barraclough
  • 2,625
  • 3
  • 36
  • 54
  • This, the error has verbage like "click here to edit the XML". I clicked on it and the entity model was regenerated. Rebuild / restart did nothing. – Rob Mar 03 '23 at 00:25
1

Some times this issue happens because the XML representation of the model has some conflicts. In my case, the error was caused because the model had a conflicted reference, in other words, there was a reference to a table that was manually removed in the XML and the removal wasn't done properly (they leaved the EntityType reference but removed all the rest).

I just opened the XML file and the issue was underlined, I just removed it, and it fixed the issue, the model was shown without any problems.

1

I had the same issue, as this is a new install.

using Visual Studio Installer, locate the highlighted option and install it

enter image description here

Mark
  • 77
  • 2
  • 10
0

I don't have the option of deleting the edmx.

I tried cleaning, exiting vs, and then building.

Solution: Copy paste from source control into the .edmx and .edmx.diagram, then rebuild.

I was getting this error from a particularly nasty merge.

christo8989
  • 6,442
  • 5
  • 37
  • 43
0

I solved the problem by modifying the installation and selecting .net desktop development module + Individual components: Entity Framework 6 tools and .NET Framework 3.5 development tools.

I don't know if less could have done the trick.

thomas nn
  • 933
  • 3
  • 13
  • 21
0

I just had the same problem after a merge. Luckily, undoing the changes to the edmx and related files in checkin window and re-adding the new files solved it for me.

Ege Bayrak
  • 1,139
  • 3
  • 20
  • 49
0

This can be the case when we migrate visual studio solution from an older version to VS 2017/2019. So, I solved it by performing the following steps (changes are highlighted in bold):

  1. Change:
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">

To

<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  1. Change (all occurrence):
<Schema Namespace="MyModelName" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">

To

<Schema Namespace="MyModelName" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">

Once complete, close and open the edmx again.

This should solve the problem.

Jhabar
  • 109
  • 10
  • There are some more URLs to change, see accepted response here: https://stackoverflow.com/questions/21152692/upgrade-to-ef6-on-net4-system-data-metadataexception-schema-specified-is-not – mBardos Oct 28 '21 at 12:58
0

I have just solved my "Entity data model designer won't open the edmx file" problem by re-installing Oracle Developer Tools for Visual Studio (my current version is 2019 16.7.4). I right-clicked on the .edmx file in the Visual Studio's Solution Explorer window, selected the 'Open with...' option and was immediately presented with the re-install pop-up window.

SHS
  • 149
  • 6
0

In my case edmx.diagram files has unrelevant text at the end of file such as

<AssociationConnector Association="MyModel.FK_SomeTable_SomeOtherTable" />&gt;&gt;&gt;&gt;&gt;&gt;&gt; FEATURE/Blahlblah

after removed

&gt;&gt;&gt;&gt;&gt;&gt;&gt; FEATURE/Blahlblah

got it worked.

Edit your xml files (edmx and especially edmx.diagram) check and correct them

asdf_enel_hak
  • 7,474
  • 5
  • 42
  • 84
0

Most quick way to fix it is to copy entire 'Models' folder from your old files and then delete (or rename) your current content of models folder.

Then open your edmx and refresh the content using 'update from database' option.

I have spent almost 5 hours using other method but stll not working. Only spent 15 minutes using this copy-paste method, and problem solved.

Ahmad Pujianto
  • 309
  • 1
  • 3
  • 11
0

If you are running into this issue when trying to remove a one-to-many relationship from two entities:

  • Open the edmx in the XML Editor (Right click the file and select Open With...)
  • Find Association element with the foreign key name that represents the relationship and delete it
  • Find AssociationSet element with the foreign key name that represents the relationship and delete it
  • Check EntityType elements on both sides of the relationship and make sure the relevant NavigationProperty element is deleted
  • Go to EntityType element for the many side of the relationship. Remove Property element for the Id on which the foreign key was established

Save the file and reopen it in the Entity Data Model Designer

Mike Kuenzi
  • 301
  • 5
  • 6