0

I have an MVC 5 project that I am working on with EF 6.x. I am using: Microsoft Visual Studio Enterprise 2017 Version 15.4.2 VisualStudio.15.Release/15.4.2+27004.2006 Microsoft .NET Framework Version 4.7.02556

I have a model that I created and did a migration to the database. However as I continued coding I realized that I needed a new column. I created it and then created a new migration and ran update-database. My new column is in the database so I went to my controller right clicked the controller action and then add view. I put the view name the template that I want to use and then select my model. When I click add I get the following error:

Microsoft Visual Studio Error

There was an error running the selected code generator:

'Error HRESULT E_FAIL has been returned from a call to a COM component.'

I can create the view without the template and model however it only seems to be the one model as I can pick others that are in the project and it will create the view on that.

Troubleshooting steps thus far:

  1. I have deleted the controller and recreated.
  2. Followed these
  3. Deleted Visual Studio cache
  4. Deleted the .suo file Deleted the
  5. .csproj.user file

Any thought to what to try next would be helpful thanks!

1 Answers1

2

Add a reference to System.Data in your project (right click References -> add new reference) fixed it for me.

Realise this is a little old, but I came across this when searching for the answer.

Zecrah
  • 41
  • 4