Visual Studio Solution for SharePoint 2013 Branding (MasterPages, Page Layouts, Images, Web Parts)
This is well-documented on the web, but the important bits (that I need reminding of) are never all in the same easily find-able place. So I put together this article to outline everything you need to do to ensure successful deployment of a Visual Studio (in my case VS Permium 2013) branding project in SharePoint 2013.
Let’s jump right in:
You need SharePoint 2013 and Visual Studio 2013 to follow along. You also need sufficient deployment privileges when creating the project or adding new items to your project. If you don’t, Visual Studio will be unable to grab the correct templates from SharePoint and will create duff code (like missing designer files, etc.).
For our purposes, we’ll do a sandboxed solution. Enter your test site address and you’re all set. This is what it should look like:
Add and customise modules for MasterPages, PageLayouts, Page Layout Icons and Style Library
Right-click on your project > Add > New Item
Then select Module, name it MasterPage and hit Add
Create 3 more modules the same way and name them:
Your project should now look like this:
You can drag your files into each of the modules from Windows Explorer, Copy/Paste them in, or use the Sample.txt files as a starting point (which is what we’ll be doing).
Custom page layouts are so much more intuitive when you create custom icons and it’s very easy. Just customise my Template in PhotoShop and create your own PNG icons.
Rename the files to match the image below (you can use the Page Layout Icon Template at the top of this page to create your own page layout icons. I also added at least one item to each of the folders created in StyleLibrary (right-click on StyleLibrary > Add New > Folder).
Update your Feature
Rename the feature to something meaningful (keep it short – in my case Branding)
Now double-click on the Feature you just renamed. This brings up a different set of properties in the Properties window (versus single-clicking on it).
Update Modules’ Elements.xml to ensure correct deployment
Note that the files that Visual Studio creates for you are NOT correct. You ALWAYS need to update your Elements.xml file, specific to what you are doing (they’re all slightly different).
Keep in mind that you have the Page Layout automatically update the content type of the page to your custom content type if you’re creating one. Just swap out this line:
Your Custom CType Name;#YourCTypeGUID;#" />
Group all your webparts in a folder called WebParts (created by Right-clicking your Project > Add New > Folder). This groups them logically and keeps your project nice and clean.
Creating web parts is simple but also have a lot of bits involved, so I’ll cover that in another article at a later date. This is pretty well documented, so you can search Google for some more info.
Comments are closed