0

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?

2 Answers 2

1

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.

6
  • How do I make the page a site page? Commented Jun 12, 2012 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 Commented Jun 12, 2012 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. Commented Jun 12, 2012 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. Commented Jun 12, 2012 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" Commented Jun 12, 2012 at 20:22
0

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.