Unable to convert to web application because the code-behind ".*" is missing

I got this weird error when I was trying to regenerate a designer page:

Unable to convert to web application because the code-behind ".*" is missing

The crazy thing was that the code-behind file was there. The only thing that was missing was the designer page.

The solution was to rename the file. As soon as I renamed it, the designer page was generated. Then I renamed it back to its original name. Done :)