Using Save Site as Template with Publishing Sites – Part 2, Creating the New Custom Visual Studio Solution

At this point I have saved my publishing site as a template and imported two modules into a new Visual Studio solution. The solution to which I have imported is an intermediate step and, as is the case with the solution I exported, it won’t work if I try to use it. There are several things I’ll need to fix up for it to work. Usually when I do this, I have an existing project that has the rest of the features for my custom publishing site. However to make this tutorial easy to follow I will start from scratch.

Begin by creating a new empty SharePoint project in Visual Studio 2010. I named mine MyPublishingFeatures. You can select either Farm or Sandbox as these features are available in either case, but I chose Farm.

After the new solution opens, add a new item by pressing CTRL+SHIFT+A, select the Module project item template and name it MyPageLayout. Repeat the process and make another module named MyPublishingPage. Then delete both of the Sample.txt files. At this point, the solution should look like this:

In Solution Explorer, right-click MyPageLayout and select Add|Existing Item…

Browse to the import project you created in the previous post and select Sample.aspx. This is the sample page layout. Repeat this process for MyPublishingPage and add the Sample-Page.aspx file to module. Solution Explorer now matches the following.


Now that we have the new project set up, it’s time to make all of the changes necessary for the whole thing to work, starting with the page layout.

Table of Contents

Using Save Site as Template with Publishing Sites – Introduction

Using Save Site as Template with Publishing Sites – Part 1, Saving the Site and Importing the Solution to Visual Studio

Using Save Site as Template with Publishing Sites – Part 2, Creating the New Custom Visual Studio Solution

Using Save Site as Template with Publishing Sites – Part 3, Fixing Up the Page Layout Module

Using Save Site as Template with Publishing Sites – Part 4, Fixing Up the Publishing Module

Using Save Site as Template with Publishing Sites – Conclusion

 

Author: Doug Ware