Aaarrrggghhh - Visual Studio 2015: there was an error running the selected code generator

Monday, January 11, 2016
by Sean McAlinden

Visual Studio 2015 fell out with me a little today.

I had clearly upset it as when I selected AddView in my ASP.Net MVC project it kept giving me the following error:

 "there was an error running the selected code generator."

I performed the No.1 IT fix (switch my maching off and on again) to no avail.

The usual suspects such as some dodgy web.config elements or some rogue dll's hanging about in my bin folders were also innocent. 

After googling around for a while and checking on Stack Overflow I still had no idea what could be causing it...

Aaarrrggghhh!!! this was starting to drive me a little bit crazy now.

As a last ditch attempt, the only thing I hadn't tried was to clean up my temporary ASP.Net files but I was not optimistic.

Then from out of Nowhere

I navigated to my temporary ASP.Net files (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files) and found something there that I had not ever noticed before... a directory named: vs

In the spirit of "act first think later" I quickly deleted the "vs" directory and low and behold it worked.


If Visual Studio decides to fall out with you by banning you from the use of a selected code generator, add the Temporary ASP.Net Files\vs directory to the list of strange places you need to check.