Creating and Deploying Custom aspx Page as Feature and Solution Package
There are two ways to deploy a custom aspx page in SharePoint.
1. Using VseWss extensions project. Here you won't need to create a solution package manually. All the files need to create a solution package are created by the VS extensions itself. See the related Post Deploy Custom Css file in 12 hive. You can use same method to deploy your Custom aspx page.
2. The second way is creating a solution package around your asp.net webapplication so that the pages in the webapplictaion can be deployed in sharepoint. This requires you to manually create all the solution related files (I mean manifest.xml, feature.xml, elements.xml and .ddf file).
In this Post, we will create a solution package manually for a asp.net webapplication project, so that the custom aspx page created in asp.net web application can be deployed in SharePoint's Layouts folder.
Below are the Steps that you can follow :
1. Create a New WebApplication Project.
2. Create a new folder "MyCustomFolder" in the solution explorer and Add your custom aspx page (along with cs file) under it.
3. Add two more xml files in the same folder with names as elements.xml and feature.xml.
The Elements.xml File should look like below -
<elements xmlns="<a href=">http://schemas.microsoft.com/sharepoint/">
<module name="Pages" url="_layouts">
<file url="CustomPage.aspx" name="CustomPage.aspx" type="GhostableInLibrary"> </file>
Note : Add Module name as “Pages” and url as ” _Layouts “
The Feature.xml File should look like below -
<feature id="79DD53E7-8719-45b0-8E25-C2450B3E3F14" title="Project.CustomPage" description="Custom Page" scope="Web" version="184.108.40.206" hidden="false" xmlns="http://schemas.microsoft/sharepoint/">
<elementfile location="CustomPage.aspx"> </elementfile> </elementmanifest>
4. Now, Create another xml file in the Project and name it as manifest.xml
The manifest.xml should look like below -
<solution xmlns="<a href=">http://schemas.microsoft.com/sharepoint/" SolutionId="A5A9C1C2-4EBF-40db-935F-66085A9E0BE8">
<assembly deploymenttarget="GlobalAssemblyCache" location="Project.CustomPage.dll">
<safecontrol assembly="Project.CustomPage Version=220.127.116.11, Culture=neutral, PublicKeyToken=a28586c97e90b41f" namespace=" Project.CustomPage" typename="*" safe="True"> </safecontrol>
Note : If you are using some code behind with your aspx page, then change the Inherit tag in the aspx page to inherit from the assembly of the project.
For e.g. change the tag to
Inherits="NameSpace.Class, NameSpace, Version=18.104.22.168, Culture=neutral, PublicKeyToken=2ef8d0c4bab8980b" Debug="true"
You dont need to deploy .cs file with the Project. The code is accessed via its .dll .
5. Finally Create the .ddf file ( its simply a text file with name as .ddf)
.ddf file would be something like below -
.OPTION Explicit ; Generate errors.Set CompressionType=MSZIP
;sets the feature directory.
;adds the feature to the feature directory
;adds the element to the feature
I have created an empty folder in the Project with a name as “Package” to save the .wsp file in it.
6. Sign the project with a key (Project Properties -> "signing tab" and browse your .snk key) and Build the Project.
7. Now, Add and deploy the .wsp solution which is under Package Folder in SharePoint using stsadm commands.