SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a visual web part through visual studio 2010 and it works nicely when I add it to web part page.

I now want to create a custom application page to consume my web part.

I created a new application page called SRPMain.aspx and the solution created it under "Layouts/Certco.SRPWebPart/SRPMain.asxp". This I understand.

I then converted the application page to a web part page by including a web part zone.

I then created a module to be able to deploy the web part part page:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
 <Module Name="SRPModule" >
  <File IgnoreIfAlreadyExists ="True" Url="SRPMain.aspx" Name="SRPMain.aspx"        Type="Ghostable" Path="_layouts\Certco.SRPWebPart\SRPMain.aspx"/>

When trying to deploy it through a feature I get this error:

Error   3   Error occurred in deployment step 'Activate Features': Failed to instantiate file "SRPMain.aspx" from module "SRPModule": Source path "Features\Certco.SRPWebPart_Feature1\_layouts\Certco.SRPWebPart\SRPMain.aspx" not found.
    0   0   Certco.SRPWebPart

It doesn't seem to be able to find the .aspx file to deploy through the feature. How do I resolve this?

share|improve this question
up vote 1 down vote accepted

WebPartZones are not supported in Application pages.

But your web aprt is "just" a web control so you can include directly into an application page.

You can also make the page a site page and deploy it using a Module as you've started to. But then the aspx file should be inside your feature folder and the Path attribute is relative to that.

share|improve this answer
How do I make the page a site page? – Walter Johnson Jun 12 '12 at 19:22
You're already a long way towards it you just need to move SRPMain.aspx to the folder where you have the Elements.xml file with the <Module> element , change the Path to just "SRPMain.aspx" and change SRPMain.aspx to inherit from Microsoft.SharePoint.WebPartPages.WebPartPage – Per Jakobsen Jun 12 '12 at 19:39
I did above. I moved the SRPMain.aspx page under the module and my Elements.xml changed to: <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="">; <Module Name="SRPModule" > <File Path="SRPModule\SRPMain.aspx" Url="SRPModule/SRPMain.aspx" /> <File Path="SRPChange.aspx" Url="SRPModule/SRPChange.aspx" /> . </Module> </Elements> It still errors on feature activation. – Walter Johnson Jun 12 '12 at 19:50
I was able to get it deployed thank you. However, where is the page deployed? I only see the module under site pages and not the actual page. – Walter Johnson Jun 12 '12 at 20:11
It should be SITEURL/SRPModule/SRPMain.aspx thats what yor specify in Url. If you want it in SitePages then you need to change the Url and specify Type="GhostabeInLibrary" – Per Jakobsen Jun 12 '12 at 20:22

In solution explorer :

-> Choose Show all files.

-> Open file in your module directory with extension .spdata

-> Look at <ProjectItemFile> of your page.

-> Edit Source and Target attributes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.