_layouts and codebehind files

Jun 21, 2007 at 2:16 PM
Edited Jun 21, 2007 at 3:09 PM
We have a default.aspx.cs file in the layouts but it doesn't seem to be supported or am I missing something?
Jun 21, 2007 at 5:16 PM
Edited Jun 21, 2007 at 5:17 PM
Source code ".cs" files are not included in the manifest.xml by default. Please read the manual:

-Excludefiletypes "cs,scc, ..." (Default is 'cs,scc'. Use comma as a separator.)
Specifies which file types to exclude in the manifest and wsp file.
Define more than one file type by using comma.
It is possible to use asterisk '*' to exclude every file type, except those defined in the Includefiletypes argument.

You can however include .cs files by re-specifying the -Excludefiletypes like this: -Excludefiletypes "scc"
So it do not exclude the .cs files but only the source safe files.
Jun 22, 2007 at 8:35 AM

RTFM -- ReadTheFuckingManual (that's normaly what I say but I like your version better ;)

Mar 10, 2008 at 12:12 PM
is only thing need to do is give the
-Excludefiletypes as "scc" ?

Don't need to give as follows in the .aspx page header area ?

<%@ Page Language="C#" MasterPageFile="~/_layouts/default.master" CodeBehind="Test.aspx.cs" %>

And , for accept code behind page (aspx.cs) , what else i have to put in .aspx page?

Can you please help me Keutmann? Thanks
Mar 13, 2008 at 1:27 AM
Rather than using CodeBehind, it is better to use Inherits (value being the full strong name of the class and assembly) and have the page class compiled as part of the WSPBuilder project.
Mar 13, 2008 at 9:18 PM
If you use CodeFile instead of CodeBehind, Sharepoint (ASP.NET actually) should pick up your uncompiled .cs file from the same layouts folder in which your .aspx page resides and compile it on the fly.

<%@ Page Language="C#" MasterPageFile="~/_layouts/default.master" CodeFile="Test.aspx.cs" %>