Scaffolding controller doesn’t work with visual studio 2013 update 2

asp.net-mvc-5asp.net-mvc-scaffoldingvisual-studio-2013

PROBLEM:

I have updated to Visual Studio 2013 update 2 and now I cannot scaffold controllers.

The problem is not project specific: when I try to scaffold a controller, I get the following error in ALL and ANY project:

There was an error running the selected code generator:
'Exception has been thrown by the target of an invocation.'

It was working before updating to Visual Studio 2013 update 2.

Have googled the issue to death, but none of the various suggestions work

Eg:

  1. Commenting out OnModelCreating in my context;

  2. Removing packages such as MvcScaffolding, etc (I have none installed and it doesn't work with ANY project);

I have modified/customised some of the templates, but it was working after the changes.

EDIT:

I uninstalled Visual Studio 2013 Update 2 and thereby reverted to Visual Studio version 12.0.21005.1 REL.

The problem has disappeared. Therefore, the problem is quite definitely with Update 2.

QUESTION:

Does anyone (including Microsoft) know of a fix?

EDIT 2:

Farruk Subhani's answer does not address the question: The question clearly states that removing references to MVCScaffolding does not solve the issue.

I have added a 200 point bounty, please address the question as clearly stated.

Best Answer

Hey for all of you that nothing works, the real answer is you need to remove ANYTHING that has a configSource on the web.config and the connection string needs to be inlined.

EDIT:

Someone pointed out that it needs to be only <configSettings>, <appSettings>, and <connectionStrings> tags NOT using a configSource attribute. And that he was still able to use configSource attributes elsewhere, such as the rewriter tag.

I think it's that the tooling cannot follow configSource locations for the stuff it uses like connection strings and application settings.

Microsoft should be on this issue if not fixed yet.

EDIT 2:

Even thought @awrigley has marked his answer as correct it's a known Visual Studio bug. I've managed to tell then and I think it will get some attention soon. https://github.com/aspnet/Tooling/issues/169#issuecomment-144197015