2

I have created a .wsp file through Visual Studio which should contain a module with my page layouts I want to deploy. To do this I downloaded my page layout .aspx that was already created on my development environment site and stuck it in my PageLayouts module in VS (I also renamed it to .layout because I read somewhere SharePoint messes with .aspx files). I made sure the module is included in my feature and that the feature is scoped to Site, then published my .wsp file.

Then, over in my test environment, I copied the .wsp to C:\Deploy\Page_Layouts.wsp and ran the following command:

Add-SPSolution -LiteralPath C:\Deploy\Page_Layouts.wsp

Usually I would also run (for webparts):

Install-SPSolution -Identity Page_Layouts.wsp -AllWebApplications -GACDeployment -Force

but this gave me an error that the solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application. I'm not sure if it should be like that or not but at any rate I would expect to see my page layout in the master page gallery if this worked correctly.

If I try to deploy to my development environment directly through VS I get the following Error:

"Error occurred in deployment step 'Add Solution': Value does not fall within the expected range."

This is what my module currently looks like in Elements.xml in case anything in there could be causing it:

<Module Name="PageLayouts">
  <File Path="PageLayouts\Three Columns Custom.layout" Url="/_catalogs/masterpage">
      <Property Name="ContentType" Value="$Resources:cmscore,contenttype_pagelayout_name;"/>
      <Property Name="PublishingAssociatedContentType" Value=";#Article Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D;#" />
      <Property Name="Title" Value="Three Columns Custom" />
      <Property Name="MasterPageDescription" Value="Three column layout" />
  </File>
</Module>
  • Try removing the -AllWebApplications switch in your command – Marius Constantinescu - MVP Oct 12 '13 at 3:36
  • Surprisingly that worked. I thought Install-SPSolution always needed a target (either -AllWebApplications or -WebApplication and specifying a site). So now I can get it to show up in my Site Collection Features but when I try to activate it it says "The URL /_catalogs/masterpage is invalid". If I try it with "_catalogs/masterpage" it tells me the specified list does not exist. I've also tried an absolute path and that doesn't work either :( – Fenoec Oct 14 '13 at 15:09
  • Got it! That Url attribute needed to be on the <Module> tag, not the <File> tag. Between changing that and removing -AllWebApplications from the Powershell command it now works. – Fenoec Oct 14 '13 at 15:26
1

Page Layouts should NOT be deployed in the SharePoint mapped folder Layouts, which actualy maps to _layouts virtual folder.

Page layouts must be deployed in the masterpage catalog under */_catalogs/masterpage* (see here http://blogs.msdn.com/b/bobgerman/archive/2011/01/31/packaging-master-pages-and-page-layouts-with-visual-studio-2010.aspx and http://historiesofsharepointlover.wordpress.com/2011/12/31/deploying-pages-layouts-using-features-in-sharepoint-2010/)

  • I've also tried this approach of making a module with the layout and setting the url attribute of the File element in Elements.xml to "/_catalogs/masterpage". The feature is scoped to Site yet I keep getting that error with the Install-SPSolution call. Nothing seems to say what the Powershell commands should be because they just say "Hit deploy in VS"; unfortunately I don't have this convenience because my VS points to my development environment but I want to deploy to my test environment. Could I just be using a wrong command? – Fenoec Oct 11 '13 at 19:47
  • My question is updated to better reflect the current situation now. – Fenoec Oct 11 '13 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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