Legion
Legion

Reputation: 3447

Entity data model designer won't open the edmx file

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.

Upvotes: 30

Views: 66975

Answers (20)

Edgar
Edgar

Reputation: 483

This happened to me when I added a field to a 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.

Upvotes: 2

Uzair
Uzair

Reputation: 1

Happened to me Opened .edmx file in the XML editor. Intellisense was throwing some warning. After resolving the warning restarted Visual Studio and it started working for me.

For my case: 'Npgsql PostgreSql Integration' was not installed. Installing it and restarting ide fixed the issue in my case.

Upvotes: 0

John Foll
John Foll

Reputation: 156

For me the problem was that it wasn't installed right. I was using a project developed by someone else and had installed Oracle Developer Tools for Visual Studio (2022). It look like it didn't need updating when I was looking at it from Nuget Package Manager. I had thought to create a new project and try to build the entity from scratch, so I created a new .Net Framework 4.8 web project and then a .net Framework 4.8 class library in same solution file, then I was going to make a connection using Oracle Developer tools Entity - and it a wizard popped up and asked me if I wanted to update the Oracle configuration - then it started downloading stuff - presumably updating it. I had to close all instances of Visual Studio for it to complete. When it was done I loaded the original Visual Studio solution file developed by someone else, and double clicked on the .edmx files and the designer opened it up! So try to build it from scratch and maybe the designer/wizard will offer to fix the install - which was my problem - it wasn't quite right or needed updating. Hope this helps someone. I dont remember exactly how I did it now, but I may have right clicked on the class library to add ADO.NET Entity Data Model and selected "EF Designer from database". Then clicked on "New Connection" -- Picked Oracle Database - I think that is what set in motion the wizard to update the Oracle Configuration.

Upvotes: -1

Mike Kuenzi
Mike Kuenzi

Reputation: 301

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

Upvotes: 0

Jhabar
Jhabar

Reputation: 129

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.

Upvotes: 2

Mark
Mark

Reputation: 79

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

Upvotes: 1

Ahmad Pujianto
Ahmad Pujianto

Reputation: 359

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.

Upvotes: 0

Charlie
Charlie

Reputation: 4895

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.

Upvotes: 28

Ashley
Ashley

Reputation: 189

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.

Upvotes: 11

asdf_enel_hak
asdf_enel_hak

Reputation: 7650

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

Upvotes: 0

SHS
SHS

Reputation: 147

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.

Upvotes: 0

Leniel Maccaferri
Leniel Maccaferri

Reputation: 102438

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.

Upvotes: 3

Fireman Sam
Fireman Sam

Reputation: 131

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.

Upvotes: 5

Ege Bayrak
Ege Bayrak

Reputation: 1199

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.

Upvotes: 0

thomas nn
thomas nn

Reputation: 943

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.

Upvotes: 0

Alejandro Tob&#243;n
Alejandro Tob&#243;n

Reputation: 47

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.

Upvotes: 1

christo8989
christo8989

Reputation: 6826

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.

Upvotes: 0

Richard Barraclough
Richard Barraclough

Reputation: 2984

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

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

Upvotes: 1

Dmass
Dmass

Reputation: 141

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.

Upvotes: 14

Legion
Legion

Reputation: 3447

Fixed by deleting the file and regenerating it.

Upvotes: 7

Related Questions