1 12 2010
Sandboxed Visual Web Part in VS2010 – ‘InitializeControl’ does not exist
(Cut to chase – your ASCX file is too large, strip out code away from the ascx preventing it from being de serialized, such as holding lots of JS in another file)
Whilst experimenting with various methods of developing client object model solutions for SharePoint 2010, I’ve been pointed towards the Visual Web Part for Sandbox solutions which comes as part of the Visual Studio 2010 Power Tools, and this looks to be a life saver!
However, I appear to have come across a bug… if you have too much data in your ASCX file, the auto-generated partial class (the .g.cs file) will disappear from your solution explorer, and you’ll get the build error The nane ‘InitializeControl’ does not exist in the current context, like so:
Removing superfluous code from your ASCX file into separate files, such as external JS and CSS files (which you should be doing come your final build anyway, right?), and next time you run a Build your .g.cs file will reappear and the build errors will be gone.