In this post, I will be sharing my recent experience where I had been working on creating SharePoint 2016 HTML master page for intranet. Initially for my development purpose I was directly creating HTML master page using SharePoint designer but when the time came, I was asked to deploy to different environment such as test environment. I finally ended up creating farm based visual studio code solution. Below are steps I had used for creating the wsp solution.
3. Add folder called 'FeatureElements' to the project.
4. Right click on FeatureElements and then add module to the folder as shown below.
5. Now, right under the module start adding your HTML files. In my case, I had all my master pages created using SharePoint designer based on seattle.html and I had imported those HTML files into visual studio solution.
6.In the element.xml under the module, make sure to the entries are present for HTML files.
7. If there are any resource files such as CSS/JavaScript/Images you can add those files to this solution by deploying it to Styles/1033 folder or layout folder of 16 hive as shown in above folder structure.
8. Now, at this stage if we deploy the above solution, html master pages will be available in master page gallery of the site collection and here you need to publish the html master page by using context menu and then it generates .master file. At this stage you apply the master page to the site. Entire process can be automated by creating a feature receiver as shown below.
9.Now, Right click on feature receiver to add event receiver as shown in the image below.
10. Once the file is created, In feature activated method add the below code
11. Double click on feature receiver to see the below properties.
12. Use the below PowerShell script to deploy the wsp to the environment.
Install-SPSolution -Identity MasterPageCustomSolution.wsp -WebApplication https://abc.com -FullTrustBinDeployment -force
13. Once the solution is deployment, go to site collection feature and activate the feature. The master page will be available for you in master page settings page and can set it as default master page.
This place is clean and has nice ambiance, more like modern than classic. Our visit was just amazing. I believe it was a treat to be at event locations here. It would be a treat to attend another event here.
ReplyDelete