Friday, April 29, 2011

Custom ASPX page and automatic deployment in SharePoint

For a particular project, I was required to built a couple of custom pages and deploy them with a WSP.


For the solution, we first need to create a Class Library project. First, create a folder structure from 12 hive, as shown below. Under layouts folder, place the ASPX pages. Then I add a folder named "ApplicationPages" and add the code behind C# files.
The Folder "ApplicationPages" is required, otherwise we can also have a folder name as "FeatureCodes". These are names that SharePoint understand well.

Next, for each of the code behind C# files, a common Namespace has been set and a separate class name is defined.
And on the ASPX page, we need to specify the assembly info. For that the project need to sign with a string name, then built and finally get Public Key Token with a tool. Here is my blog for easy retrieval of Public Key Token. 

On each of ASPX page, we have to set the Assembly info, Public key token in the page directive area.

After that, build the project, and create a WSP using WSP builder. Finally deploy the WSP with a STSADM command.


Cheers...
Somu