Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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="http://schemas.microsoft.com/sharepoint/">
 <Module Name="SRPModule" >
  <File IgnoreIfAlreadyExists ="True" Url="SRPMain.aspx" Name="SRPMain.aspx"        Type="Ghostable" Path="_layouts\Certco.SRPWebPart\SRPMain.aspx"/>
 </Module>

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

1 Answer 1

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? –  user8746 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="schemas.microsoft.com/sharepoint/">; <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. –  user8746 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. –  user8746 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

Your Answer

 
discard

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.