0

When I try to add Controller using build-in generator I get following error message:
Error message box on controller generation

Where "Brand" is a model class and "ApplicationDbContext" is my data context class.
I never encoutered error like this before. It does not occur all the time (2 success vs 30-40 attempts without changing single line of code). I was able to create Controller for same class minutes ago, but it's really annoying when you try to add something new and try more than 10 times with no results.
Of course, I could write my own controller and views, but I really like using included tools.
I have already repaired VS using "Modify" option in "Add or remove". I'm using latest Microsoft Visual Studio Community (MVSC2015 V14.0.25425.01 Update3).
EDIT:
Brand.cs:

namespace AppBrander.Models  
{  
    public class Brand  
    {  
        public int ID { get; set; }  
        public string Email { get; set; }  
        public string BrandName { get; set; }  
        public string CompanyName { get; set; }  
        public string Description { get; set; }  
    }  
} 

Works in brand new project, fails in old - I guess it's just my VS installation being totally messed up. I should have been guessed, but I just did second repair...

Hekkaryk
  • 522
  • 5
  • 13
  • Can you please share your Brand model class? – Sanket Aug 10 '16 at 09:51
  • @Sanket2 Found error there - I don't know how it passed that 2 times. I will post answer below ^^" – Hekkaryk Aug 10 '16 at 12:04
  • I thought I found out what is happening, but I was wrong. I'm editing post for more info. – Hekkaryk Aug 10 '16 at 12:48
  • 1
    @Akkaryk: Are you compiling/building your projects before doing Scaffolding when you change the models? This is required in order for the scaffolding engine to recognize the newly added types – Tseng Aug 10 '16 at 14:32
  • @Tseng I never thought about it... But yes, after first error box I did compile/build (and clean, rebuild, debug - basically everything that came to my head). Right now I work in new project when generating succeded... randomly, without changing anything. – Hekkaryk Aug 11 '16 at 06:50

0 Answers0