This short blog post is about well know fact and all Sitecore veterans will just smile, but for all newbies like me, it will save you some time.
So, after you insert new sublayout or master page, there is one obvious thing you should do and that is :
- include the file to project in Visual Studio, that you can work with it.
Then you will build the solution and you are happy, all works as expected. But here comes trouble. There is something missing, one file that Sitecore is not creating by itself and that is :
- .designer.cs file
Then you might to have some error like this one, but only after you add some control/controls :
Basically, this file is needed for VS 2010 and VS 2012 to be able to work with objects you create in .aspx file also in code behind file. VS is creating .designer.cs file and maintaining them by itself, but Sitecore is not. You have to do this by hand, like this :
You can do this over whole project, or just over new file.
Hope this saved you some time.
Some more articles about converting to Web Application Project :