Fixing code generator : “object reference not set” VS 2017 MVC scaffolding controller for ASP.NET MVC

885 0

There was an error running selected code generator: “object reference not set”

enter image description here

I have tried all the solution like repairing the VS 2017 but no use. And guess what, this is happing more often in VS2017

I figured Out a solution and want to share with anyone having the same issue:

Step1: Clean Visual studio and rebuild

Step 2: If one did not solve , close and reopen Visual studio. Then rebuild the solution

Step 3: if step2 did not solve the issue:Go to C:\Users\username\AppData\Local\Microsoft\VisualStudio\\15.0_b3b9e12d and delete   ComponentModelCache

Step 4: if all 3 did not solve the issue(this works for me)

  • Close the solution
  • Delete the .VS in your solution folder.
  • start the solution and you should be OK

If this did not work for you and you found another solution, please comment below. It this work for you also, leave a message to help others.

Related Post