Sharepoint - Visual Studio 2012. Visual webpart's ascx.g.cs file empty after registering any control

This may be unrelated, but did you put a proper URL in your project's Site URL field, and can you properly deploy and activate an empty solution from VS?

I find that the designer files are not generated properly if my site URL is faulty (VS can't connect to it) or if I lack the permissions to deploy and activate a solution from within Visual Studio.


This one worked for me:

  • Highlight YourControl.ascx file in solution explorer.
  • In properties window locate Custom Tool property and set it to SharePointWebPartCodeGenerator
  • If your *.ascx file is valid, the ascx.g.cs should be generated as a result

In my case, Custom Tool property was empty and because of that there was no sign of a g.cs file.