Pages

Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Saturday, March 12, 2011

How to force visual studio to put content into designer file

Web development model in Visual Studio .Net has changed a lot from its first release. At the moment we have different project types for web development.
Recently I have begun working with a project initially developed many years ago and this project has an old structure. So I tried to convert it to a web project. One problem I faced was not having a seperate file for the designer generated codes, because the support for partial classes added later. It is not actually a problem but I wanted to know how I could easily force the visual studio to put designer generated stuff into a seperate file. After some struggling I found this simple method:
  • Just add a file with the name yourfilename.aspx.designer.cs to project.
  • Delete the auto generated codes in the main codes file.
  • Mark your page's class as partial.
  • Then when you save yourfilename.aspx the next time, visual studio will put the generated content into desginger file.