From VS Feedback: Hello, When I want to update from database on my model of Entity Framework, the changes doesn't save.
EF Team Triage: This issue is lacking enough information for us to be able to effectively triage it. In particular, it is missing the following information requested in the new issue template. Can you please provide this information?
Steps to reproduce
Ideally include a complete code listing that we can run to reproduce the issue.
Alternatively, you can provide a project/solution that we can run.
BTW we're not just doing this to be mean :smile:... we get a lot traffic on this project and it takes time to attempt to reproduce an issue based on fragments of information. In addition, our attempt is often unsuccessful as the exact conditions required to hit the issue are often not explicitly included in the code provided. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we ask that folks give us a self-contained way to reproduce an issue.
For a guide on submitting good bug reports, read Painless Bug Tracking.
BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.
Hey, I think I'm having the same issue as mentioned in the original visual studio feedback post.
From what I can tell the problem seems to be the T4 templates aren't running after the changes are saved in the ADO.NET Entity Data Model Designer.
So, I'm running VS 2019 RC 2 (16.0.0 RC.2) loading project with an edmx generated in VS 2017, when I open the designer and update from the database I can see the .edmx and .edmx.diagram files are being updated, but .cs context and model files aren't.
If I then right click on the .tt files and select "Run Custom Tool" then the .cs files are updated as expected.
The only errors / warnings I'm seeing are related to tables without primary keys.
"Show output from 'Entity Data Model'" shows only info related to loading the model from the database:
The model was generated with warnings or errors.DataModel.edmxPlease see the Error List for more details. These issues must be fixed before running your application.
Loading metadata from the database took 00:00:01.1222942.
Generating the model took 00:00:03.0944214.
I'm having a similar issue - Right click on the model -> update from database -> add new table -> save edmx -> build project. Table is not on the drawing, but the class files have not been generated for the new tables.
This is a known issue in VS2019 and we are working on a fix. The workaround is quite simple--use "Run Custom Tool" to cause the updates to happen, as described in the comment above by neoGeneva.
I'm running VS 2019 RC.2 and have this issue. I tested before upgrading, so it wasn't working on RC, RC.1 and RC.1 SVC1.
Workaround is to 'Run Custom Tool' on .tt files
It seems this bug was present in VS2012 and was fixed in VS2012 Update 1
The fix is checked in locally. Current plan is it be released in VS2019 Version 16.1.
@lajones Any chance this could hit in 16.0.x? Not being able to update from database (unless you know the 'Run Custom Tool' workaround) is a pretty significant bug for GA.
@RNCRyan I'm afraid not. 16.1 is where smaller bugs with workarounds are being put right now. 16.0 is only taking more serious changes. Sorry!
IMHO this is a pretty serious issue, VS 2019 is currently unable to allow us to update our EDMX files.
For me, in version 16.0.0, the "run custom tool" workaround doesn't work.
The only workaround is to revert to VS 2017 which is pretty unfortunate.
@mehalick If "Run Custom Tool" doesn't work, then I think you're hitting a different scenario. Can you file a new issue including a small, runnable project/solution that reproduces what you are seeing.
Closing as the fix has been merged for 16.1 preview 1.
@mehalick Just to repeat - I have tested this again on the most up to date version of 16.0 I can find and running the Custom Tool on the .tt files always works for me. It was mentioned somewhere online - if somehow the Custom Tool got cleared you might see no updates. So:
1) Make sure your changes to the .edmx are saved.
2) In Solution Explorer, go to each of the .tt files, click on them and look in the Properties Window.
3) For the property Custom Tool you should see the value TextTemplatingFileGenerator. If that value is not present or is something else change it to that, save and then Run Custom Tool on the .tt files (you may have to do it manually, but for me it kicked off automatically once I saved the new Custom Tool value).
If you still don't see updates after all of that then please do raise a different bug and post the project in which you are seeing this effect, and the precise set of steps that you are doing and we'll try to track it down.
That said 16.1 Preview 1 should be out very soon and the fix for all of this is already checked in to that.
@lajones @ajcvickers I can confirm that "Run Custom Tool" does work as expected for me on a different machine using the same repo and also the latest version of 16.0. Not sure what the issue was but if I run into it again I'll consider filing a separate issue.
With a workaround available I'll just wait for the fix in 16.1, this sounds great. Thank you for everything...
Very annoying bug that prevent all of us to fully enjoy Visual Studio 2019 16.0.1. If this is fixed in 16.1, can't wait to have it ! Reverted to 2017 for now. Playing with tools and tt is not my cup of tea !
16.1 preview 1 is now available
Hey there, I've just downloaded 16.1 preview 1 and can confirm the issue is fixed for me.
Too bad. Going back to VS 2017
While you're at it, make it so we don't have to delete the table on the designer surface and re-add it when a column is deleted from the database ;) Then have to rename any custom fields again.. sigh
Glad to hear there is a fix in the works. I had to go back to 2017 in the mean time.
I have also encountered the issue where manually running the custom tool may not always work. Sometimes I must run the tool 2 or 3 times before the template is finally regenerated and contains the database changes. Sometimes running the tool works on the 1st try multiple times in a row and then just stops working reliably and I must run the tool multiple times before it works. It's very inconsistent.
Desesperating
Get Outlook for Androidhttps://aka.ms/ghei36
From: Shaw Young notifications@github.com
Sent: Friday, May 3, 2019 5:58:07 PM
To: aspnet/EntityFramework6
Cc: GearTheWorld; Comment
Subject: Re: [aspnet/EntityFramework6] Code is not generated automatically on model change in VS2019 (#705)
I'm running VS 16.0.3 and have the same issue?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faspnet%2FEntityFramework6%2Fissues%2F705%23issuecomment-489058767&data=02%7C01%7C%7Ca7ce66e7e10d4033bff008d6cfb63a24%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636924778891936895&sdata=eHNYrE6eHyo70lturevnoV089sq7nb0e8EZEVYx3rEA%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACBXA6FSCBSFOZBFTSFENYTPTQLD7ANCNFSM4GT3QF4A&data=02%7C01%7C%7Ca7ce66e7e10d4033bff008d6cfb63a24%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636924778891946900&sdata=VvW20clwpjxR5zBrwg4IzEeF1OxBjBA72VVij2ZtC%2FQ%3D&reserved=0.
Any update? I am facing the same issue in Microsoft Visual Studio Community 2019, Version 16.4.6
I'm still seeing issue in Pro Version 16.4.3
oh very very good excellent
thank you very much
Most helpful comment
This is a known issue in VS2019 and we are working on a fix. The workaround is quite simple--use "Run Custom Tool" to cause the updates to happen, as described in the comment above by neoGeneva.