Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 error creating an EDMX file

In Visual Studio 2013 (Update 2, and later Update 4), using Entity Framework 6.1.2, I am having issues when creating an EDMX file.

When creating the file, I add a new item, select "ADO.NET Entity Data Model", and regardless of whether I create an "Empty EF Designer model" or "EF Designer from database" (and regardless of which database I might chose if building off of a database) I receive a very generic error message:

"Operation is not valid due to the current state of the object"

and it kicks me back to the Add New Item wizard. The *.edmx is generated, but if I attempt to open the generated *.edmx file, I receive another generic message:

"The operation could not be completed."

The *.designer.cs file appears to be populated, but not all of the assembly references are added to the project; System.Data.Entity had to be added manually for references to System.Data.Objects to resolve.

I have installed Entity Framework 6 Tools for Visual Studio 2012 & 2013, for both versions of Visual Studio. I have tried performing this with the projects both bound to TFS as well as unbound, and the error persists in either situation.

If I open the solution in Visual Studio 2012, the same errors persist. I am able to add an *.edmx file in Visual Studio 2010 successfully, and then later open the project in Visual Studio 2013, and the *.edmx file is present and accessible; it opens and I am able to view it, but if I move or edit, I am given the following error:

"XmlModels involved in this transaction are not editable."

Does anyone have any suggestions for that is happening, or what might be missing from my environment? I'm at a loss for what is improperly set up on my system.

like image 590
Erik Frantz Avatar asked Jan 30 '15 16:01

Erik Frantz


1 Answers

Based on the error "XmlModels involved in this transaction are not editable", I was able to track down a response to a similar issue:

Entity Framework Unable to refresh database tables under TFS 2010

In short, my project and solution were stored on disk at C:\Code\C#\Application\[etcetera]

The issue was the "#" character in the solution/project/file path. Quickly copying the solution to C:\Code\CSharp\[etcetera] solved the issue of both adding and editing an existing *.edmx file.

I am answering this to preserve the Wisdom of the Ancients.

like image 191
Erik Frantz Avatar answered Oct 16 '22 04:10

Erik Frantz