Fixing the build errors in Visual Studio after inserting new sublayout to Sitecore via backend web page

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 :

sitecore convert to web applicaton error

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 :

sitecore convert to web applicaton

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 :

http://msdn.microsoft.com/en-us/library/aa983476%28v=vs.100%29.aspx

http://stackoverflow.com/questions/735054/how-to-convert-asp-net-website-to-asp-net-web-application

Leave a Reply

Your email address will not be published. Required fields are marked *