Cannot add controller in ASP.NET MVC project

I'm trying to add a controller in my ASP.NET MVC project.

I am using Entity Framework Code First (5.0), and when I right-click the Controllers folder in my project and selecting Add Controller:

After selecting MVC controller with read/write actions and views, using Entity Framework and other settings, I get this message:

There was an error generating '{0}'. Try rebuilding your project.


Seems that the special constructor I added to the DbContext caused the problem. After commenting out the constructor, it's working back again, however this message appeared:

Anyway I checked the activity log and found no info regarding that issue or any record at the occurrence timeline, should you know what this is all about, please comment on.


Seems that the special constructor I added to the DbContext caused the problem. After commenting out the constructor and re-compiling, it's working back again.

Perhaps I should wrap the constructor contents in a conditional statement that is skipped at design-time, meanwhile commenting-out is enough for me.

"Build the application before going on to the next step. If you don't build the application, you'll get an error adding a controller." "If you get an error, you probably didn't build the application before starting adding the controller." You must run project, probability.

Need Your Help

Customize uikeyboardtype with and numbers

ios objective-c ipad uikeyboardtype

I want to create a UIKeyboard type that will look like the following.

Is there any way to generate MS Build from n existing C# project in VS?

c# visual-studio visual-studio-2012 msbuild selenium-webdriver

I am new to the .Net world I am trying to do some continuous delivery on a project of NUnit tests written in C# , these tests run fine on the Visual Studio, but I want to build it using MsBuild and...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.