Here is what happens when I try to update model from database with VS express 2013 for the web, EF6.1.1 and .NET framework 4.5.
In this case I just added a field to a table in the table definition and updated the database.
After that I right click update model from database in the EDMX model view and I get this error message:
An exception of type ‘System.runtime.interopServices.COMException’ occurred while attempting to update from the database. The exception message is: ‘A file or folder with the name ‘Model.Context.tt’ already exists. Please give a unique name to the item you are adding or delete the existing item first.
I noticed that I get the same error message when I try to generate the database from the model.
I tried the following methods:
but none of them worked.
I also found that https://entityframework.codeplex.com/workitem/1104 and it seems that it has been resolved with “commit 7e8331d1d22d (EFTools repo)”.
Anyone can help me on how to solve my problem or on what is “commit 7e8331d1d22d (EFTools repo)” ?
Thanks
Boid’
This can be achieved in several ways: setting the EntityState for the entity explicitly; using the DbContext. Update method (which is new in EF Core); using the DbContext. Attach method and then "walking the object graph" to set the state of individual properties within the graph explicitly.
It's an old question but I just run into the same issue. Finally found a solution in this bug report. Check if you have any *.tt files that are not added to solution and remove them. That fixed the problem for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With