views:

156

answers:

3

I'm reading a book that recommends clicking a check box that says "Place code in separate file" when adding a new Web Form to an existing ASP.NET project. The book is using Visual Studio 2005 and there is a check box for "Place code in separate file" when you open the "Add New Item" dialog.

I am using Visual Studio 2008 and I do not see the "Place code in separate file" checkbox when I try to add a new item. Is there something I need to do to enable this? Was this functionality no longer possible/important in VS 2008?

+3  A: 

I believe in 2008 it is the default behaviour.

If you add an apsx file it will add the aspx.cs without any interaction from yourself.

Kindness,

Dan

Daniel Elliott
Ah, I see that now that I open it up in Windows Explorer. I didn't notice the code behind file in VS's Solution Explorer. Much thanks.
Ben McCormack
+1  A: 

VS 2008 adds a code behind file by default.

Oded
+1  A: 

This option depends on the type of project you are building:

  • If you are building a Web Site (File | New > Web Site, contains an /App_Code folder, the code is not compiled into a .dll in the /bin folder) then you will have the option (ticked by default in VS2008/2010) to "Place code in separate file", and also "Select master page".
  • If you are building a Web Application (File | New > Project, doesn't have an /App_Code folder, compiles all .cs/.vb files into one .dll in the /bin folder) then you don't have the option to not create a separate code file, and when you add a new item it's either a "Web Form" or a "Web Form using Master Page".
Zhaph - Ben Duguid