Regenerate a broken designerfile

by Grank August 27, 2008 18:12
Hey all,
There seems to be some bugginess in VS 2008 sp1 that we were struggling with a little bit today.
At this last point, after a 5 minute chain of subtle weird behaviors, I somehow ended up with an empty .designer.cs file for my aspx page.  Which of course is not only highly annoying, but completely build-breaking, since your actual code-behind can't reference any controls that appear in the markup if they're not declared for it in the designerfile.
I don't yet know why this is happening, but it of course doesn't fix itself by adding or editing markup controls like you'd think it should. (if it did, it probably wouldn't be screwing up in the first place!)
If you need to get the designer.cs file regenerated quickly (so as to, say, be able to check in your work without breaking everyone's build when they get latest), just:
  1. Delete the .designer.cs file
  2. Right-click on the aspx file in solution explorer
  3. Select "Convert to Web Application" if it appears in the context menu.  (If it doesn't, click around or twiddle your thumbs or something until VS realises there's no designerfile anymore and repeat steps 2-3)

Voila, a regenerated designer file, and your code-behind starts working again.  (Until, of course, VS screws up again.  It kept doing this to me continually all day.  I wish you luck.)

I may or may not do a follow-up post on wtf is going on here, depending mainly on whether or not I ever actually figure that out...

Tags: , ,

Comments

Add comment


(Will show your Gravatar icon)

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen | Modified by Mooglegiant

About The Author

I'm a software developer and musician in Edmonton, AB.  I write mostly web-based software, primarily on the Microsoft stack.  I have an MCPD and several MCTS, but I've only been at this whole developer thing for a few years, and the truth is that I'm still learning more than knowing.  So these are my adventures and experiments and some of it will probably be blatantly wrong...  Just warning ya.