Designer cs file not updating

Sometimes when I'm editing page or control the .designer files stop being updated with the new controls I'm putting on the page.

I had to delete the .file then recreate an empty file with the same name. Visual Studio 2010 was refusing to update the designer file.

When I went back in and saved the aspx file again, the designer file was re-generated. As it turns out, VS doesn't modify the designer file for a page that uses Code File (run off of pages) instead of Code Behind (DLL).

Some people have also reported success by deleting the .file and then recreate an empty file with the same name.

Well I found a solution that works, though I don't really like it.

So, you have to stop debugging, trivially edit the ASPX page (like add a button or something), then click Design View, then delete the button. If you are having a different issue with VS2008, then I can't help.

Just to add to the long list of answers here - I've just run into this issue in VS2010 (SP1) with an file.

I'm using Visual Studio 2008 EDIT: Sorry I should have noted I've already tried: If you open the file and switch between design view and html view and back it will prompt VS to check the controls and add any that are missing to the designer file.

In VS2013-15 there is a Convert to Web Application command under the Project menu.

Most cases can be solved by editing the ID of a server control (just add a character, then delete it).

Also remember that control inside things like Repeaters aren't visible in the designer file.

However when you do this, it usually pops up with the error, as to why it didn't auto-regen in the first place, its usually a control ref that isn't declared in the head of the page.

Tags: , ,