AuthorBart van Duinkerken

Visual Studio 2019 EDMX files not updating

On April 2nd, 2019 Microsoft released their newest Visual Studio 2019. As a developer who works with Visual Studio daily, I immediately downloaded the newest IDE and started to use. I enjoyed it from the start and the small UI differences work great. But this post is not about how it works but about a feature that is not working, hopefully yet.

In one of my projects we are still using a database first approach with an EDMX file in Entity Framework. We generate SQL scripts for updating our database and then we update our EDMX file, in a separate C# Class project. We use the normal EDMX database first approach by following the next few steps after updating tables or columns in our development database.

  1. Open EDMX file
  2. Right click file and select ‘Update Model from Database’
  3. I then choose my Database Objects and Settings and Click finish.
  4. Then my EDMX file is updated and I can save my file.

In Visual Studio 2017 saving my EDMX file also updated corresponding files under Model.TT. But with the introduction of Visual Studio 2019 only the .diagram file is being updated. This causes an issue because your new tables and columns are not accessible through Entity Framework Database Context. I struggled with this issue for a while and since Visual Studio had just come out, I could not find much information regarding the issue on the internet. I tried removing the EDMX and recreating it but no effect. It was also not a strategy I wanted to do every time I updated our database.

I finally came across a solution about EDMX not updating in a version of Visual Studio dating back to 2013. I tried it in my solution, and it worked. I now must execute a few additional actions before my EDMX project is successfully updated for use. I hope the following steps will become obsolete once again after a next update of Visual Studio 2019. 

Solution 

I open the sub files of my Model.edmx file which contains files with the following extensions.

  • Model.Context.tt
  • Model.Designer.cs
  • Model.edmx.diagram
  • Model.tt

I right click each of the files with the right click on my mouse and then select ‘Run Custom Tool’. Executing these steps will update all corresponding files so they can be used. I believe only the Model.tt file needs to be used by ‘Run Custom Tool’ but I have decided to run them all in case I missed something. 

Run Custom Tool in Visual Studio 2019 for EDMX files

I hope this will help people that have run into the same issue in Visual Studio 2019 or any other version of Visual Studio. And I hope Microsoft will fix this issue in one of the upcoming updates.

C# MVC broken Razor Intellisense

Today I was looking at the new feature Microsoft announced a few weeks ago that Xamarin is now in Visual Studio by default. After working with it for a few hours I had to go back and make some changes to one of our web mvc projects. At that moment I saw that I did not have anymore Razor Intellisense in Visual Studio. The first thing I tried was restarting Visual Studio, but no effect. So I opened different web project to see if Razor Intellisense was working their, but also broken. So I went online and tried to find an answer.
Continue reading

Multiple Active Results

Recently I was creating a new Web Application using Entity Framework Code First principal. After a while I was getting the hang of it when I got an error message which I couldn’t place and had not seen before. It was of the type EntityCommandExecutionException and the Inner Exception said There is already an open DataReader associated with this Command which must be closed first.

Continue reading

Visual Studio “Run with CMD”

I have been working with visual studio and .net application for a few years now. And one of the things we use a lot are deploy commands. In the beginning I would go to the Windows Explorer and run from there. But I found out that it was much easier to create a menu item in Visual Studio called “Run with CMD”. Now a days I upgrade visual studio as soon as I can get a new laptop from work and I have to create the item again. I always struggle on getting it set up, also when colleagues of mine ask me how to do this. Therefore I have decided to write an article about it describing how it is done using simple steps and images. Continue reading

Succes met Google Remarketing

Google RemarketingAdverteren op Google is een marketing techniek die al jaren zeer populair is in Nederland. Sinds een jaar of twee is het in Nederland ook mogelijk om retargeting toe te passen met Google remarketing. Met de feature van AdWords is het mogelijk om je bezoekers zo gericht mogelijk relevante advertenties te tonen. Sinds kort is deze feature nog gemakkelijker met een nieuwe koppeling tussen Google AdWords en Analytics. Continue reading

Plugin by Social Author Bio