<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CleverWorkarounds &#187; CSS</title>
	<atom:link href="http://www.cleverworkarounds.com/category/sharepoint/branding/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cleverworkarounds.com</link>
	<description>After much frustration, it seems DEFAULT is the way to go...</description>
	<lastBuildDate>Mon, 07 Jun 2010 10:20:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SharePoint Branding Part 7 -The &#8216;governance&#8217; of it all..</title>
		<link>http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/</link>
		<comments>http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 17:16:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[COBiT]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[Governance]]></category>
		<category><![CDATA[ISO17799/27001]]></category>
		<category><![CDATA[ITIL]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Solutions]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[page layouts]]></category>
		<category><![CDATA[planning]]></category>
		<category><![CDATA[Branding Series 1]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/</guid>
		<description><![CDATA[Well, here we are! After delving into dark arts where everybody but metrosexual web designers fear to tread (HTML and CSS), we then delved into the areas that metrosexual web designers truly fear to tread (packaging, deployment and even some c# code!). Finally, we get to the area where everybody is interested until it happens [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p>Well, here we are! After delving into dark arts where everybody but metrosexual web designers fear to tread (HTML and CSS), we then delved into the areas that metrosexual web designers truly fear to tread (packaging, deployment and even some c# code!). Finally, we get to the area where everybody is interested until it happens to get in their way! (Ooh, I am a cynical old sod tonight).</p>
<p>That is Governance!</p>
<p><span id="more-266"></span><br />
May I start by quoting from that wise band &#8220;Faith No More&#8221; and their first hit &#8220;We Care A Lot&#8221;, who in 1987 were of course thinking of collaborative document management when they wrote..</p>
<p><em>&#8220;We care a lot about the gamblers and the pushers and the geeks<br />
We care a lot about the crack and smack and whack that hits the street<br />
We care a lot about the welfare of all the boys and girls<br />
We care a lot about you people cause we&#8217;re out to save the world</em></p>
<p><em>And it&#8217;s a dirty job but someone&#8217;s gotta do it&#8221;</em></p>
<p>Now, we are only going to talk about governance in relation to branding here, which is really a pimple on the butt of the overall governance of SharePoint. In saying that though, much of the philosophical basis from which I write this article is pretty much applied to the other areas of SharePoint governance anyhow.</p>
<p>So, what are we trying to do anyway? If you go and google or wikipedia the subject of governance, you can pretty much summarise the academic definition as &#8220;cover your ass&#8221;! Whether you are answerable to the CEO of a blue chip with a billion dollar market cap, or to the CEO of a 25 user small business, if you are going to take the fall, you want to make sure you take a few others with you, right? <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Therefore, one of the first governance issues to deal with is the fact that we need a team with well defined roles and responsibilities. Each team will cover off different areas of SharePoint governance that can broadly be grouped into a few different categories:</p>
<ul>
<li>Project Management</li>
<li>Infrastructure</li>
<li>Development/Design</li>
<li>Operation</li>
<li>Training</li>
</ul>
<p>Now, you may group things a little differently then me, but you get the idea. I have deliberately NOT listed design (and with it branding) separately because it depends on the type of SharePoint project being implemented. If it is a web content management oriented project (like an internet site), then design probably warrants its own category. However, if it is a collaborative project, then design is quite likely part of development process.</p>
<p>I think this point deserves further consideration.</p>
<h2>WCM vs Collaborative Sites</h2>
<p>SharePoint is a multipurpose beast. It can be used as a straight out CMS system and compete with the likes of <a href="http://www.joomla.org/">Joomla</a>, <a href="http://drupal.org/">Drupal</a>, <a href="http://www.reddot.com/">RedDot</a> and <a href="http://www.episerver.com/en/">EpiServer</a>. It can also be used as a document management system, management reporting tool, project tracking system, collaboration platform and so on and so forth&#8230;</p>
<p>When used as a CMS only, it&#8217;s pretty good, all things considered. There are some pretty snazzy examples of WCM sites that make you stop and think, &#8220;wow &#8211; is that SharePoint?&#8221;. But the typical visitor to a WCM based SharePoint site will not likely be using many of the other goodies that SharePoint offers. In these type of sites, there are a few content authors, but mostly the people using the site are visitors consuming the web content. Really, that&#8217;s about it.</p>
<p>But if you have been reading this series of articles, I spent the first three talking about how much of a pain the core.css and application.master issue is on corporate branding. If you haven&#8217;t, I suggest taking a look.</p>
<p>The issue is that many aspects of collaborative functionality use parts of SharePoint that is tough to brand. <a href="http://cameronmoll.com/archives/2007/10/sharepoint_2007_pointedly_unskinnable/">Cameron Moll</a> has written a brilliant article on this issue and I consider it mandatory reading. Many collaborative functions are based on a central master page called APPLICATION.MASTER. Therefore, if you have made a well branded master page for your content, the user experience will be inconsistent when they perform certain administrative type tasks.</p>
<p>Cameron nails the issue perfectly here: &#8220;This is all perfectly fine in the CMS scenario, as only an infinitesimal fraction of your users will switch between published screens and admin screens. However, in the collaboration scenario, nearly any user can, and will, switch between published screens and admin screens to complete tasks. Because your skinning won’t be reflected in the admin, what should otherwise be a continuous visual flow for users instead becomes a jarring transition from your beautiful theme to SharePoint’s vanilla theme and back again&#8221;.</p>
<p>Now this entire series of articles has been based on the &#8216;other&#8217; side of SharePoint (i.e. *not* WCM). In my opinion, in a purely collaborative SharePoint implementation, branding should be one of the <strong>last</strong> things you do. Your time is better spent refining collaborative functionality. However if you are doing WCM, it should be one of the <strong>first</strong> things to do.</p>
<p>You can imagine then, that the worst case scenario for all involved in a SharePoint project is mixing WCM and collaboration. It carries with it the exact same type of problems and risks that I outlined in my <a href="http://www.cleverworkarounds.com/2007/10/31/sharepoint-sucks-at-document-management-or-does-it-a-metal-perspective/">article</a> on collaborative document management vs records management. Try and do both, and you will not only dilute the benefits of each, but you end up with an over time/budget process with plenty of pissed users and stakeholders.</p>
<p>Moral of the story? Decide what you want to be!</p>
<p>So let&#8217;s move on.</p>
<h2></h2>
<h2>Best Practice Standards</h2>
<p>A while back, I posted a series of <a href="http://www.cleverworkarounds.com/2007/10/09/it-governance-standards-cobit-iso1779927001-itil-and-pmbok-%e2%80%93-part-1/">articles</a> on best practice methodologies and the laws around compliance. For many areas of governance, much of the work is done for you by these best practice standards. Certainly, aspects of the ITIL books on ICT change management, deployment management, design and planning and operations management will factor in branding governance.</p>
<p>I hope for people who have read those articles wondering why I included my four articles in a SharePoint oriented blog, you should see it all start to come together now. They are your philosophical starting point to approaching SharePoint governance</p>
<p>For what it&#8217;s worth, although ITIL is currently flavour of the month for many IT departments, I think that you can get a lot out of ISO27000/27001 and COBiT as well. ITIL is very inwards facing in a lot of its subject areas. What I mean by that is that non IT Senior management and board level tend not to give a crap about ITIL, but are likely to have more of an interest in COBiT, particularly in the US (not just because it has prettier pictures either). COBiT is a much &#8220;higher level&#8221; standard than ITIL, and is a better philosophical starting point than ITIL which is more prescriptive. In reality the standards well complement each other, but if you are wondering which one to start on, I&#8217;d go with COBiT. (Another much more detailed post on SharePoint governance against these standards is in the works).</p>
<h2>It&#8217;s a dirty job but someone&#8217;s gotta do it</h2>
<p>So let&#8217;s start with some high level governance principles for branding a collaborative SharePoint site. Here is what we need to define and document.</p>
<ul>
<li>A management structure for supporting the development and deployment of branded MOSS Sites</li>
<li>Key roles and responsibilities within this structure</li>
<li>Policies, standards, guidelines, and decision processes required to support the deployment of branded SharePoint Sites</li>
</ul>
<p>What are the rationales for setting up a framework to assign accountabilities?</p>
<ul>
<li>Knowing who is responsible for making decisions</li>
<li>Knowing how decisions are made</li>
<li>Knowing who is responsible for implementing decisions</li>
</ul>
<p>In addition to this, branding governance aims to:</p>
<ul>
<li>Consistently provide a high quality user experience by ensuring that the branding governance plan is followed</li>
<li>Establish clear decision making authority and escalation criteria so that issues are resolved on a timely basis</li>
<li>Ensure compliance with established corporate style guide</li>
</ul>
<h2><font color="#000000">Roles and Responsibilities</font></h2>
<p>ISO27000/27001 puts a big emphasis on accountability. Without a strong culture of accountability, it is very difficult to adopt governance without it getting out of hand. One organisation I worked for had mapped out their process for dealing with the service desk and it was too big for an A4 sized page. It had to be printed on poster size and was the ugliest flowchart you have ever seen. This is a common symptom when clear lines of accountability do not exist. There is safety in complexity and ambiguity.</p>
<p>Thus, it is vitally important that the right roles are assigned the right responsibilities and people are fully aware of where their accountability lies.</p>
<p>The following table is a typical example of the roles and responsibilities of personnel involved in the governance of the MOSS branding. Depending on the size of your organisation, consolidate the roles and positions to suit. I&#8217;ve put the responsibility definitions into cleverworkarounds&#8217; plain english to make it more interesting, but you may want to formalise these a little more if you use this <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<table border="1" width="600" cellPadding="2" cellSpacing="0">
<tr>
<td width="200" vAlign="top"><strong>Role </strong></td>
<td width="198" vAlign="top"><strong>Position </strong></td>
<td width="200" vAlign="top"><strong>Responsibility</strong></td>
</tr>
<tr>
<td width="199" vAlign="top">Steering Committee</td>
<td width="198" vAlign="top">Senior Divisional Heads<br />
Marketing Manager<br />
IT Manager<br />
SharePoint Architect</td>
<td width="201" vAlign="top">The buck stops here! If it all goes to hell, these are the guys who get burned! (but have no doubt they will apportion the blame all round)As a result of that prospect, they tend to like to signoff on all branding things! (and everything else too)Oddly enough, they also therefore believe that they provide vision and direction to the MOSS branding</td>
</tr>
<tr>
<td width="198" vAlign="top">Business Owner</td>
<td width="198" vAlign="top">Board Level Project Sponsor</td>
<td width="202" vAlign="top">The person who writes the cheques! They are who the steering committee answers to. Thus, people are generally very nice to them!They get to set the direction of what they want, even if their branding taste is dodgy <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (If they try and mix WCM and Collaboration try and tactfully dissuade them)</td>
</tr>
<tr>
<td width="199" vAlign="top">SharePoint Support Team</td>
<td width="197" vAlign="top">Application Support Manager<br />
SharePoint Administrator<br />
SharePoint Designer<br />
SharePoint Developer</td>
<td width="202" vAlign="top">These guys take all the vision stuff from the Business Owner and Steering Committee and actually designs and develops the corporate MOSS brandThis team also resolves operational issues and enforces best practice in relation to the MOSS branding solution</td>
</tr>
<tr>
<td width="199" vAlign="top">Site Collection Owner</td>
<td width="197" vAlign="top">SharePoint Administrator</td>
<td width="202" vAlign="top">Activation of branding features is performed by the site collection owner</td>
</tr>
<tr>
<td width="199" vAlign="top">Infrastructure Operations Team</td>
<td width="197" vAlign="top">Farm Owner<br />
Site Collection Owner<br />
Infrastructure Owner</td>
<td width="202" vAlign="top">These guys keep the support team honest. They ensure that branding is packaged up according to policy and install those features/solutions to the farm. This ensures the technical integrity of the branding development</td>
</tr>
</table>
<h2>Policies and Standards</h2>
<p>So now we have defined who is responsible for what, we can now put it all into policy.</p>
<h3>Corporate Style Guide</h3>
<p>The first thing you need to do is define a corporate style guide, or locate the existing one and refresh it via the steering committee. The style guide houses all relevant standards, requirements, and recommendations surrounding corporate brand. It is not a technical document, as it covers the tone, presentation and all implementation aspects, specifications, attributes and elements, summed up to present a brand consistently throughout all media.</p>
<p>This guide changes over time and its owner is likely the marketing division of the organisation and not just the SharePoint branding steering committee. It is best to engage with the division or individual that owns this guide, to ensure that the steering committee is in the loop during periods of review and updating.</p>
<p>Once you have an approved style guide, you can now apply it to SharePoint components.</p>
<h3></h3>
<h3>Master Pages</h3>
<p>If you adopt the principles of my earlier posts in this series, you may not need to have more than a single master page for your entire farm. A well defined master page with clever use of CSS override techniques allow you to offer different branding, yet using a single master page. If this is a realistic prospect for you, then it makes sense to enshrine in policy that you will only maintain one corporate master page.</p>
<p>Best to leave the master page in the master page gallery for the site collection. That document library has versioning and content approvals enabled. Thus, it eases change and configuration management, as well as packaging and deployment.</p>
<p>The master page should be named according to a consistent convention. I personally like to prepend the company name to the master pages, as well as layout pages as then it is very easy to see what components are customised from what is build in. I enshrine this in the branding policy as a mandatory requirement.</p>
<p>That master page should be well documented with all of the modifications made to it. Typically, if you have modified say, DEFAULT.MASTER, you will have to document modifications like</p>
<ul>
<li>Any assembly references added to the master page (see <a href="http://www.cleverworkarounds.com/2007/10/15/careful-with-pre-requisite-sharepoint-features/">this post</a> if you want an explanation)</li>
<li>Any hard-coded links to other CSS files and the definition of new styles</li>
<li>Modification of the HTML structure of the master page (e.g. Adding left and right borders to the default master page)</li>
<li>Any examples of non-compliance with the corporate style guide</li>
</ul>
<h3></h3>
<h3>Layout Pages</h3>
<p>A collaborative style SharePoint site may require additional layout pages. The rules pretty much apply as per master pages.</p>
<ul>
<li>Name them consistently with master pages (eg prepend company name)</li>
<li>Document their setup, where it is used and why it was required</li>
</ul>
<h3>Styles</h3>
<p>Corporate style sheet guidelines should be documented and these are a direct translation from the corporate style guide. Logo&#8217;s, fonts, formatting, colors, backgrounds, etc are documented either as mandatory standards or recommended guidelines in the CSS style guide.</p>
<p>In addition, CSS style sheets should be both well documented within the CSS file using comments, as well as documentation around the implementation of the style. If you have overridden say, some of CORE.CSS, then mention it in the comments for the style why it was done.</p>
<p>CSS styles should live in the Style Library for each site collection. Unless you have an exceptional reason, there is no point in reinventing the wheel and putting them anywhere else. Naming of CSS sheets should also be consistent with the master pages and page layouts. So if I was writing a governance policy for ABC corporation, I would use something like</p>
<ul>
<li>ABCDefault.master</li>
<li>ABCWelcomeSplash.aspx</li>
<li>ABCDefaultStyle.CSS</li>
</ul>
<h3>Site Templates</h3>
<p>Although I didn&#8217;t cover site templates in this series on branding, the concept is simple. Once you have set up a site the way you want it, you can save it as a template that can be re-used for other sites. Certainly, it is common for project oriented companies to create a project site template with a particular combination of lists, web-parts, workflows, event handlers and libraries. Each time a new project is initiated, a site is created for that project based on the template.</p>
<p>This helps us to achieve the governance of a consistent user experience, as well as improving change and configuration management.</p>
<p>The process of creating a site template is potentially complex as the amount of collaborative functionality provided grows over time. Therefore, guidelines for the development of site templates must be developed to ensure they meet minimum standards. Potentially, site templates will be used by different organisational groups, with their own unique requirements. You will need to find a balance between overall site/branding consistency versus the costs and overheads of accommodating unique requirements.</p>
<p>Therefore, a formal approval process culminating with steering committee approval should be in place to manage the ongoing management of every corporate site template. The corporate style guide will also very likely influence the look and feel of custom site templates.</p>
<p>For each template, you also need to determine which parts of the template may be changed by site owners, and which may not. This can be enforced by security settings, but you still need the official policy to fall back on if tool based controls do not give you what you need.</p>
<p>Having said all of this, much of the governance around site templates is focused on non-branding considerations such as security, audiences, functionality and the like. We will not discuss this here as it is not really a branding consideration.</p>
<p>The point is, site templates have similar branding governance requirements to master pages, page layouts and styles.</p>
<h2>Operational Management</h2>
<p>In the previous section I looked at the governance requirements of branding from a SharePoint building block point of view. Now lets take an ITIL oriented perspective</p>
<h3>Change management and approvals</h3>
<p>With change management, go straight to ITIL and get what you need as far as process is concerned. ITIL defines the objective of change management as:</p>
<p>&#8220;The objective of Change Management in this context is to ensure that standardized methods and procedures are used for efficient and prompt handling of all changes to controlled IT infrastructure, in order to minimise the number and impact of any related <a href="http://en.wikipedia.org/w/index.php?title=Incidents&amp;action=edit">Incidents</a> upon service.</p>
<p>ITIL defines a CAB or change authority board that advises the &#8216;change manager&#8217; prior to change approval. For my money, the steering committee will delegate the CAB function to the other groups who assume *custodianship* of the process. For example, the steering committee still bear ultimate accountability over the deployment of branding, but once the policy has been set, they delegate the validation of the deployment to the IT Infrastructure Operations Team.</p>
<p>Now bear in mind, we are talking about branding only here, and ITIL in the wrong hands can create ridiculous amounts of red tape.</p>
<p>But in relation to change management, this is the sort of stuff that should be considered.</p>
<ul>
<li>Change justification. Have we recorded the request (who and why)?</li>
<li>Assess the impact of the change (cost vs benefit)</li>
<li>Test the change. Any branding changes require comprehensive testing on a non production environment. You never know how various web-parts render, and a formal testing methodology must be defined to ensure that say, your latest snazzy style turns out to make the calendar view look crap.</li>
<li>Packaging and deployment. Updates to branding should be packaged and deployed in accordance with corporate policy. The goal here is to ensure efficient, consistent deployment with easy means of rollback. We will delve more into packaging and deployment in a moment.</li>
<li>Implement the change, update documentation and logs</li>
<li>Conduct post implementation review of the change</li>
</ul>
<h3>Packaging and deployment of branding</h3>
<p>Well, unless you are reading this series backwards, I think you should have a fair idea by now that I recommend that all branding should be implemented as a SharePoint solution. Check article <a href="http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/">four</a>, <a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">five</a> and <a href="http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/">six</a> for more info. For me personally, I consider that if an application developer does not comply with this requirement (or whines about having to comply), then they have no serious idea about the importance of governance. That for me is a risk that I would prefer not to live with.</p>
<p>You will need to ensure that if 3rd party developers are doing your branding, that they are aware of all your other branding requirements, such as naming conventions so that the content packaged up inside the solution follows your governance standard.</p>
<p>When branding is packaged up into a SharePoint solution, we have a single file than can be easily deployed to the farm, upgraded and rolled back. In a disaster recovery situation, re-applying your branding is literally as easy as installing the solution and activating it.</p>
<h3><strong>Source control </strong></h3>
<p>On a large scale site, you may opt to use source control like <a href="http://subversion.tigris.org/">Subversion</a> for your branding components, especially if you are writing custom event receiver assemblies as I described in article <a href="http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/">six</a>.</p>
<p>But then again, SharePoint itself is actually a great platform for implementing a governance site. You can make use of version enabled document libraries to hold your packaged solutions, procedures, standards and guidelines and other related content. Plus, you can use a calendar list+workflow for scheduling and notifying stakeholders of updates or changes, a task list for logging and tracking issues and infopath+workflows for automating the change management process.</p>
<p>Furthermore, I have found <a href="http://www.colligo.com/products/sharepoint/reader.asp">Colligo Reader</a> to be very useful for SharePoint governance sites, as it alleviates the chicken-egg risk of storing all of your governance and change history in the same tool that you are governing. Often I am asked, &#8220;what if SharePoint is down, how can I get to my documentation?&#8221;.</p>
<p>Colligo allows you to have a full offline sync of all your governance lists, documents and views, thereby significantly reducing this risk and that barrier to adoption. I also suggest that you buy a copy of this product and add to your governance policy that you will always keep an up to date sync of your governance site offline.</p>
<h2>Summing Up</h2>
<p>So finally it ends. I originally thought I&#8217;d cover it all in 3 articles but in the end it took 7 large articles. But I&#8217;ve now gotten to the end of this arduous task of attempting to cover SharePoint branding from end-to-end. I hope that you have found this series of articles of use, and I appreciate you for sticking with me. If these articles were of help to you, please drop me a line and let me know. If you really want to show your appreciation, and you live in Perth, West Australia, I&#8217;m quite partial to Hoegaarden <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (but if its your buy I&#8217;ll drink anything! <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  )</p>
<p>over and out</p>
<p>Paul</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6551570212921028";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_ui_features = "rc:6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding Part 6 &#8211; A &quot;solution&quot; to all issues?</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/</link>
		<comments>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 22:42:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[Governance]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Branding Series 1]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/</guid>
		<description><![CDATA[There has been a bit of a gap in this series between part 5 and 6 &#8211; and fortunately for the both of us, I think this is the penultimate post in my series on SharePoint branding. While it has been an interesting exercise for me, I must confess each successive article is getting harder [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p>There has been a bit of a gap in this series between part 5 and 6 &#8211; and fortunately for the both of us, I think this is the penultimate post in my series on SharePoint branding. While it has been an interesting exercise for me, I must confess each successive article is getting harder to write as my interest is shifting <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   So many sub-disciplines within MOSS &#8211; I think I might delve into WCM soon <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p><span id="more-265"></span></p>
<p>To recap for those of you hitting this page first, I suggest you go back and read this series in order.</p>
<ul>
<li><a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">Part 1</a> dealt with the publishing feature, and some general masterpage/CSS concepts and some quirks (core.css and application.master) that have to be worked around.</li>
<li><a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">Part 2</a> delved into the methods to work around the application.master and core.css issue</li>
<li><a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">Part 3</a> delved further into the methods to work around the application.master and core.css issue and the option that solved a specific problem for me</li>
<li><a href="http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/">Part 4</a> then changed tack and introduced how to package up your clever branding via features</li>
<li><a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">Part 5</a> expanded on features and also noted a couple of major bugs that can catch you out if you aren&#8217;t aware of them</li>
</ul>
<p>Now, we will finish off on features and move onto solutions. As you will see, aside from playing a very important part in SharePoint deployment/governance process, solutions actually solve one of the bugs I mentioned in <a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">part 5</a> &#8211; the one where deactivating and reactivating a branding feature does not always update the components. (More on that later).</p>
<p>In addition, whilst our feature is not too bad, it is not uber clever yet! As described in the previous article, a site collection administrator still has to manually perform some tasks after activating the feature. This may be totally fine, but generally, you would only activate a branding feature, if you meant to use it.</p>
<p>So presently, we have to pick the our master page from the master page list, as well as apply the right theme based CSS file as shown in the two images below.</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image15.png"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb2.png" /></a></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image16.png"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb3.png" /></a></p>
<p>We know how much of a strain those 2 steps must be to those bleating, underworked and overpaid site administrators, but fear not, lazy ones! We do have the means to do this automagically!</p>
<h2></h2>
<h2>Feature Receiver Assembly</h2>
<p>SharePoint features have the facility where you can write custom code that is triggered when certain events happen to features. It is a class called <a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spfeaturereceiver.aspx">SPFeatureReceiver</a> and when used, it traps events that are raised after Feature installation, uninstallation, activation, or deactivation action has been performed.</p>
<p>We are going to write some code that waits for the feature to be activated, and then set the master page for the site collection to pimpmysharepoint.master. While we are at it, we will do the CSS override too.</p>
<p>At this point if you are not a programmer, your eyes may glaze over at the stuff below. If you are happy to believe me that you can make the master page default to pimpmysharepoint.master then feel free to skip to the next section.</p>
<p>For the rest of you&#8230;</p>
<p>In our Feature.XML file, we add a new parameter in the &lt;feature&gt; XML element called &#8220;<a href="http://msdn2.microsoft.com/en-us/library/ms436075.aspx">ReceiverAssembly</a>&#8220;. It specifies the assembly holding the feature. Another parameter called ReceiverClass specifies the class within the aforementioned assembly. The XML element looks something like</p>
<p>ReceiverAssembly=&#8221;CleverWorkarounds.PimpMySharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4r56efbb122b266&#8243;<br />
ReceiverClass =&#8221;CleverWorkarounds.PimpMySharePoint.SetDefaultMasterPage&#8221; &gt;</p>
<p>This now tells the feature that when the feature is installed, activated, deactivated or uninstalled, call the above assembly DLL and look in the CleverWorkarounds.PimpMySharePoint.SetDefaultMasterPage class.</p>
<p>Let&#8217;s look at that class source code.</p>
<p><font face="Courier New">namespace CleverWorkarounds.PimpMySharePoint<br />
{<br />
    public class SetDefaultMasterPage : Microsoft.SharePoint.SPFeatureReceiver<br />
    {<br />
        public override void FeatureActivated (SPFeatureReceiverProperties properties)<br />
        {<br />
            SPWeb MyCurrentWeb = properties.Feature.Parent as SPWeb;<br />
            MyCurrentWeb.MasterUrl = &#8220;/_catalogs/masterpage/pimpmysharepoint.master&#8221;;<br />
            MyCurrentWeb.CustomMasterUrl = &#8220;/_catalogs/masterpage/pimpmysharepoint.master&#8221;;<br />
            MyCurrentWeb.AlternateCSSURL = &#8220;/Style Library/pimpmintyfresh.css&#8221;;<br />
            MyCurrentWeb.Update();<br />
       }<br />
    }<br />
}</font></p>
<p>The namespace line (namespace CleverWorkarounds.PimpMySharePoint) matches the first part of the &#8220;ReceiverAssembly&#8221; parameter in the FEATURE.XML file. The class line (public class SetDefaultMasterPage : Microsoft.SharePoint.SPFeatureReceiver ) corresponds to the ReceiverClass parameter in the FEATURE.XML</p>
<p>Now SharePoint can find the DLL and the class to use.</p>
<p>Inside the class, it expects to find some code for each event. In the example above,  we are only looking at the &#8220;FeatureActivated&#8221; event. So this assembly will only do something on feature activation, not install/uninstall/deactivation.</p>
<p>Looking at the activated event, it&#8217;s pretty easy to see what is happening.</p>
<p>SPWeb MyCurrentWeb = properties.Feature.Parent as SPWeb;<br />
            MyCurrentWeb.MasterUrl = &#8220;/_catalogs/masterpage/pimpmysharepoint.master&#8221;;<br />
            MyCurrentWeb.CustomMasterUrl = &#8220;/_catalogs/masterpage/pimpmysharepoint.master&#8221;;<br />
            MyCurrentWeb.AlternateCSSURL = &#8220;/Style Library/pimpmintyfresh.css&#8221;;<br />
            MyCurrentWeb.Update();</p>
<p>This code gets the current site collection the feature has been activated on, and sets the master page to pimpmysharepoint.master and sets the default CSS override..</p>
<p>Here is the full FEATURE.XML that incorporates the featuredependency directive we talked about in the last post, along with the receiverclass.</p>
<p><font face="Courier New">&lt;Feature Id=”01c34560-6561-11dc-8314-0800200c9a66″<br />
    Title=”Pimp my SharePoint”<br />
    Description=”This is a feature that adds a new sexy CSS”<br />
    Version=”1.0.0.0&#8243;<br />
    Scope=”Site”<br />
    ReceiverAssembly=&#8221;CleverWorkarounds.PimpMySharePoint, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=c4r56efbb122b266&#8243;<br />
    ReceiverClass =&#8221;CleverWorkarounds.PimpMySharePoint.SetDefaultMasterPage&#8221;<br />
    xmlns=”</font><a href="http://schemas.microsoft.com/sharepoint/”"><font face="Courier New">http://schemas.microsoft.com/sharepoint/”</font></a><font face="Courier New">&gt;<br />
    &lt;ActivationDependencies&gt;<br />
        &lt;ActivationDependency FeatureId=”F6924D36-2FA8-4f0b-B16D-06B7250180FA”/&gt;<br />
    &lt;/ActivationDependencies&gt;<br />
    &lt;ElementManifests&gt;<br />
        &lt;ElementManifest Location=”ProvisionedFiles.xml”/&gt;<br />
    &lt;/ElementManifests&gt;<br />
&lt;/Feature&gt; </font></p>
<p>So ,now the feature is much more clever. As clever as a branding feature needs to be. Of course, if the feature is deactivated, you should also write code against the deactivating event and reset all the customisations back to defaults, but for my purpose, this is <strong>clever!</strong></p>
<p>CleverWorkAround Rating &#8211; Sweeeeeet</p>
<h2>Uh-Oh, but what about the assembly DLL?</h2>
<p>Hang on a second! It&#8217;s all well and good to have a feature refer to an assembly DLL that you have written to do clever things, but what if that DLL isn&#8217;t there? Shall we be like Mythbusters and try anyway? <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p><font face="courier new">C:\&gt;stsadm -o installfeature -name pimpmysharepoint</font></p>
<p><font face="courier new">Operation completed successfully.</font></p>
<p><img src="http://www.listal.com/image/28461/60.jpg" /> Damn, that myth is totally busted <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>Ah well, let&#8217;s activate the feature since &#8216;activation&#8217; was the only event we actually trapped for!</p>
<p><img src="http://shopping.discovery.com/DiscoveryStore/images/products/xxsmall/24704-038_XXS.jpg" /> YEAH BABY! A big, feral error runtime error! Now that is what I call a mythbusters moment!</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb.png" alt="image" height="250" style="border-width: 0px" /></a></p>
<p>And for those lovely search engine spiders, here it is in plain text (in teeny tiny font because you probably don&#8217;t care that much about it anyway <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Anyway, the first line confirms it. &#8220;Feature x could not be installed because the loading of the event receiver assembly x failed&#8221;.</p>
<p><font size="1">Feature &#8217;01c34560-6561-11dc-8314-0800200c9a63&#8242; could not be installed because the loading of event receiver assembly &#8220;CleverWorkarounds.PimpMySharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4r56efbb122b266&#8243; failed: System.IO.FileLoadException: Could not load file or assembly &#8216;CleverWorkarounds.PimpMySharePoint\, Version\=1.0.0.0\, Culture\=neutral\,\tPublicKeyToken\=c4r56efbb122b266&#8242; or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0&#215;80131047)<br />
File name: &#8216;CleverWorkarounds.PimpMySharePoint\, Version\=1.0.0.0\, Culture\=neutral\,\tPublicKeyToken\=c4r56efbb122b266&#8242;<br />
   at System.Reflection.AssemblyName.nInit(Assembly&amp; assembly, Boolean forIntrospection, Boolean raiseResolveEvent)<br />
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection)<br />
   at System.Reflection.Assembly.Load(String assemblyString)<br />
   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() </font></p>
<p><font size="1">   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()<br />
   at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)<br />
   at Microsoft.SharePoint.SPFeature.Deactivate(SPSite siteParent, SPWeb webParent, Boolean fForce)<br />
   at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId, Boolean force)<br />
   at Microsoft.SharePoint.SPFeatureCollection.Remove(Guid featureId)<br />
   at Microsoft.SharePoint.ApplicationPages.DeactivateFeaturePage.LnkbtnDeactivateFeature_Click(Object objSender, EventArgs evtargs)<br />
   at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)<br />
   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)<br />
   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)<br />
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)<br />
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)<br />
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) </font></p>
<p>So, it should now be obvious that the DLL holding your event receiver class should be deployed to your web front end servers, either in the GAC, or in the BIN folder of each web app under INETPUB.</p>
<p>But how lame is that? You go to all that trouble to make a auto-installing feature and then you need to manually do this bit??? Isn&#8217;t that a little counter intuitive?</p>
<p>Fear not readers, you now know why SharePoint &#8220;Solutions&#8221; are the things that REALLY matter!</p>
<h2>SharePoint Solutions &#8211; The plain english description</h2>
<p>Back in this <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-%E2%80%9Cfeatures%E2%80%9D-in-plain-english/">early post</a>, I defined SharePoint Features as &#8220;a method to add/customise many areas of SharePoint&#8221;. Well, guess what, so are solutions as well! So what is the difference between the two?</p>
<p>Well, to answer that, let&#8217;s consider some of the things that you cannot do in a feature.</p>
<ul>
<li>You cannot deploy an assembly to the GAC</li>
<li>You cannot edit the web.config of a web application</li>
<li>You cannot install a feature to all web front end servers in a farm at once</li>
</ul>
<p>The latter is an important one. One of my clients has a 5 server farm with 3 WFE servers. If say, I have to update a webpart, I have to put the assembly into the GAC on all three servers. I then have to edit web.config on the web applications to mark the control as safe.</p>
<p>This is not only tedious but risky. Mistakes can be made, leaving WFE servers in an inconsistent state. (Hands up who has killed a web application because of a mistake in web.config. I bet all of you!)</p>
<p>If we have to roll back to a previous version, we have to do it manually on all three WFE servers. Also, what if we have several related features to install at once? That&#8217;s a lot of manual work and I am cheap and lazy!</p>
<p>So, <a href="http://msdn2.microsoft.com/en-us/library/aa543214.aspx">MSDN</a> says this about solutions: &#8220;The Microsoft Windows SharePoint Services solution framework provides a way to bundle all of the components for extending Windows SharePoint Services in a new file, called a solution file. A solution file is a cabinet or .CAB-based format with a .wsp extension. A solution is a deployable, reusable package that can contain a set of features, site definitions, and assemblies that you can apply to a site, and can also enable or disable individually. You can use the solution file to deploy the contents of a Web Part package, including assemblies, class resources, .dwp files, and other package components&#8221;</p>
<p>Therefore, to really be clever with the deployment of our clever branding, we now need to take our feature, and add it to a solution, that also copies the feature receiver assembly (DLL) into the GAC. In addition, the solution will do this consistently to all WFE servers, ensuring that they are consistent. If any one of them has a problem, we can roll back the solution deployment, fix the issue, and then re-deploy the solution.</p>
<p>CleverWorkAround Rating: Mandatory! If it is not a solution, I ain&#8217;t putting it in!!</p>
<h2></h2>
<h2>Okay so how do I build my solution then?</h2>
<p>Well, I have to say, when MOSS07/WSS3 came out, this was a truly <a href="http://msdn2.microsoft.com/en-us/library/bb466225.aspx">ugly</a> process. In the last year, plenty of clever people have written tools to make the job easier.  Let&#8217;s examine the one I use: <a href="http://www.codeplex.com/wspbuilder">WSPBUILDER</a></p>
<p>I won&#8217;t fully detail the product &#8211; hey that&#8217;s what the wspbuilder site is for. But I will explain how to use it for the purpose of this branding exercise.</p>
<p>So assuming you have WspBuilder installed, we have two things to install.</p>
<ol>
<li>The &#8220;CleverWorkarounds.PimpMySharePoint.DLL&#8221; eventreceiver assembly.</li>
<li>The PIMPMYSHAREPOINT feature</li>
</ol>
<p>To create the solution, you can follow these basic steps (although real SharePoint developers will snigger at this, as I am not integrating this into a visual studio project).:</p>
<ul>
<li>In the folder where WspBuilder was installed (I&#8217;ll assume C:\Program Files\WSPBuilder for now), create the following folder structure if it does not exist:
<ul>
<li>12\Template\Features (eg C:\Program Files\WSPBuilder<strong>\</strong>12\Template\Features)</li>
</ul>
</li>
<li>Copy the PIMPMYFEATURE folder into the above folder, resulting in C:\Program Files\WSPBuilder<strong>\</strong>12\Template\Features\PimpMySharePoint</li>
<li>In the folder where WspBuilder was installed (I&#8217;ll assume C:\Program Files\WSPBuilder), create the GAC folder if it does not exist:
<ul>
<li>C:\Program Files\WSPBuilder\GAC</li>
</ul>
</li>
<li>Copy the CleverWorkarounds.PimpMySharePoint.DLL<strong> </strong>assembly to the C:\Program Files\WSPBuilder\GAC folder</li>
<li>Open a command prompt, and CD to the location of wspbuilder
<ul>
<li>cd \program files\wspbuilder</li>
</ul>
</li>
<li>Type wspbuilder at the prompt and press Enter
<ul>
<li>c:\program files\wspbuilder&gt;wspbuilder</li>
</ul>
</li>
<li>The wspbuilder program will package up your components and create three files.
<ul>
<li>wspbuilder.wsp</li>
<li>manifest.xml       </li>
<li>solutionid.txt</li>
</ul>
</li>
</ul>
<p>For those of you who are really interested, the WSP file name will default to the name of the folder where WSPBUILDER.EXE resides. I strongly suggest renaming this to a meaningful name or running wspbuilder from an appropriately named folder. For our purposes, I renamed it to pimpmysharepoint.wsp.</p>
<p>Right! Now we have our magical WSP file. We need to add this solution to the SharePoint farm &#8216;solution store&#8217;, and then deploy this solution.</p>
<h2>Deploying the solution and testing</h2>
<p>To add the solution to the store, we use the STSADM command. But first, let&#8217;s clean up so we can test this.</p>
<p>Firstly, delete or rename the pimpmysharepoint feature in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES folder. We want to see that the solution adds it back when deployed.</p>
<p>Also check the C:\WINDOWS\ASSEMBLY and ensure your assembly is not in the GAC. If it is, remove it.</p>
<p>So, back to STSADM. Below is the syntax..</p>
<p><font face="Courier New">C:\Program Files\WSPBuilder&gt;stsadm -o addsolution -filename pimpmysharepoint.wsp </font></p>
<p><font face="Courier New">Operation completed successfully. </font></p>
<p><font face="Courier New">C:\Program Files\WSPBuilder&gt; </font></p>
<p>Okay, now what? Well.. we now <strong>deploy</strong> this feature.</p>
<p>Deployment can be performed via STSADM or SharePoint Central Administration. I actually prefer central administration because it tells me more and leaves less to chance. (I tend to type badly and make spelling errors <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In Central Administration, navigate to Operations -&gt; Solutions Management under &#8220;Global Configuration&#8221;</p>
<p>Well how about that! There is our pimpmysharepoint.wsp file. Note that its status is &#8220;not deployed&#8221;.</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image1.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb1.png" alt="image" height="138" style="border-width: 0px" /></a></p>
<p>I guess the only thing to do is to deploy it then! <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Clicking the pimpmysharepoint.wsp link presents us with the solution deployment screen. Here we can see a summary of the solution. One of the key thing that we can see is that our solution contains an assembly DLL (&#8220;contains global assembly&#8221; is YES)</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image2.png"><img border="0" width="574" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb2.png" alt="image" height="301" style="border-width: 0px" /></a></p>
<p>Click &#8220;Deploy Solution&#8221;. The next screen is the most important one of all. We are provided with a means to deploy this solution at a later time (perhaps on a weekend or other quiet time). The other really interesting thing is because this solution is of type &#8220;web front end server&#8221; (see previous image), we have the choice of which web application to deploy this solution to.</p>
<p>This is really important! Just because we have a solution added to the farm solution store, does not mean that we want to pimpmysharepoint feature installed on every web application.</p>
<p>I personally prefer to specify the web application the feature is for, rather than deploy to all of them. For a start, if you deploy to all, you are including the central administration site itself, as well as the SSP sites. I think 95% of the time they don&#8217;t need it. I&#8217;d rather keep such an important web application nice and vanilla).</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image3.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb3.png" alt="image" height="320" style="border-width: 0px" /></a></p>
<p>For what its worth, depending on the solution components and scope, you can pick all or one web application to deploy to. If you have more than one web application that needs this feature, you can come back into this screen again via the solution management section in central admin. From there you are able to choose another web application.</p>
<p>Regardless of this, the assembly only gets loaded into the GAC once! It will do a version check if it finds one already there.</p>
<p>Click OK and if all goes to plan, the solution is deployed!</p>
<p>Let&#8217;s go and check!</p>
<p>First up, examine C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES folder. Is there a PIMPMYSHAREPOINT folder? Yes indeedie!</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image4.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb4.png" alt="image" height="224" style="border-width: 0px" /></a></p>
<p>Secondly, is our DLL in the GAC? Yep..</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image5.png"><img border="0" width="310" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/11/image-thumb5.png" alt="image" height="192" style="border-width: 0px" /></a></p>
<p>So things seems to be looking good!</p>
<p>Note! If we had several WFE servers, in this case, the feature and assembly would be been installed on all WFE servers for the solution to successfully be deployed. From a governance point of view, this is a significant time saver and ensures all WFE servers are consistent.  If say, the deployment of the solution failed for one WFE server, you will be notified of the failure.</p>
<h2></h2>
<h2>Upgrades and rollback</h2>
<p>But it gets even better. Solutions can be upgraded. So you have new master page content and optimise the code in your feature receiver event handler. Simply recreate the WSP file using WSPBuilder. Then you can replace the existing solution with your updated one.</p>
<p>The beauty of this is that an upgraded solution will update the feature, install the newer assembly on all WFE servers. In addition, if something goes wrong, SharePoint will automatically roll back to the pre-upgrade solution as well!</p>
<p>A solution is upgraded when a newer WSP file is created. The STSADM -o upgradesolution command is used to do the upgrade. For example.</p>
<p><font face="Courier New">C:\Program Files\WSPBuilder&gt;stsadm -o upgradesolution -name pimpmysharepoint.wsp -filename pimpmysharepoint-v2.wsp </font></p>
<p>Want to retract a deployed solution from a site? That&#8217;s easy too. You can do it via the solution management admin screen in central administration or use the STSADM -o retractsolution command. You can retract a solution from one or all web applications as well.</p>
<p>In our sample, retracting a solution from a web application will remove the feature from the feature list. You will no longer be able to activate it.</p>
<p>Finally, you can completely remove the solution as well. This will do a complete cleanup. The PIMPMYSHAREPOINT feature folder will be deleted from C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES  and the cleverworkarounds.pimpmysharepoint assembly will be removed from the GAC.</p>
<h2></h2>
<h2>But wait! there&#8217;s more!</h2>
<p>If I haven&#8217;t convinced you enough already, I will give you one more reason. In <a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">part 5</a> of this series, I outlined the stupidly annoying issue where the deactivation and reactivation of a branding feature will not work properly. Specifically, feature files will <strong>not be overwritten </strong>when they have been modified via publishing a new version of files within the site collection galleries. &#8220;Seems that as soon as a <strong>new version </strong>has been published, any updates via a feature <strong>will not overwrite</strong>. The feature gives no indication that this has occurred either!&#8221;</p>
<p>But guess what! When you upgrade a solution via STSADM -o upgradesolution, this issue does not occur. All updates to features that are packaged into a solution get properly distributed to any site collection that has the pimpmysharepoint branding feature activated!</p>
<p>Why the behaviour is different when deactivating and activating a feature is anybody&#8217;s guess, but it works for me!</p>
<h2>Summing Up</h2>
<p>My aim in this article was to educate and convince you that solution&#8217;s the best way to install features. Notwithstanding the fix for my annoying feature bug, the ability to push out updates across multiple servers consistently, and ease of upgrades and retracting make your complex environment just that little bit more manageable.</p>
<p>So if a 3rd party tells you &#8220;oh just put this updated DLL into the GAC&#8221;, politely tell them that if it is not packaged into a solution, you are not going to do it! <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Might sound tough, but there is pretty good reasoning behind this attitude. My <a href="http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/">last post</a> of this branding series will expand on this sort of thing when I cover the governance of SharePoint branding, based on all we have learned so far.</p>
<p>For now though, I hope you found this post useful!</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6551570212921028";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_ui_features = "rc:6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding Part 5 &#8211; Feature Improvements and Bugs</title>
		<link>http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 17:14:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[Branding Series 1]]></category>
		<category><![CDATA[SharePoint Branding]]></category>
		<category><![CDATA[SharePoint Features]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/</guid>
		<description><![CDATA[So, here we are at the fifth article in my series on SharePoint branding. By now, we have left all the master page stuff way behind, and we have created a custom feature to install our branding to a server. To recap for those of you hitting this page first, I suggest you go back [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p><!--adsense--></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, here we are at the fifth article in my series on SharePoint branding. By now, we have left all the master page stuff way behind, and we have created a custom feature to install our branding to a server.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">To recap for those of you hitting this page first, I suggest you go back and read this series in order.<br />
</font></span></p>
<ul style="margin-left: 41pt">
<li><a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/"><span style="font-size: 14pt; color: #669966; font-family: trebuchet ms; text-decoration: underline"><font size="2">Part 1</font></span></a><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"> dealt with the publishing feature, and some general masterpage/CSS concepts and some quirks (core.css and application.master) that have to be worked around.<br />
</font></span></li>
<li><a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/"><span style="font-size: 14pt; color: #669966; font-family: trebuchet ms; text-decoration: underline"><font size="2">Part 2</font></span></a><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"> delved into the methods to work around the application.master and core.css issue<br />
</font></span></li>
<li><a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/"><span style="font-size: 14pt; color: #669966; font-family: trebuchet ms; text-decoration: underline"><font size="2">Part 3</font></span></a><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"> delved further into the methods to work around the application.master and core.css issue and the option that solved a specific problem for me<br />
</font></span></li>
<li><a href="http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/"><span style="font-size: 14pt; color: #669966; font-family: trebuchet ms; text-decoration: underline"><font size="2">Part 4</font></span></a><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"> then changed tack and introduced how to package up your clever branding<br />
</font></span></li>
</ul>
<p><span style="font-size: 14pt; font-family: trebuchet ms"></span></p>
<p><span id="more-248"></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Now we will move onto some more advanced aspects of features to make it more clever and identify two really annoying bugs that can make the whole experience painful. You should be aware of them.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, picking up where we left off, we have a feature that we successfully deployed to the SharePoint server. It performed the tasks of copying CSS files to the style library of the activated site collection and copying the master page file to the master page gallery.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">As described in the previous article, we still have to manually perform some tasks after activating the feature. We have to pick the PIMPMYSHAREPOINT.MASTER from the master page list, as well as apply the right theme based CSS file as shown in the three images below.<br />
</font></span></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/clip-image001.gif"><font size="2"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb1.gif" /></font></a><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image15.png"><font size="2"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb2.png" /></font></a><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image16.png"><font size="2"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb3.png" /></font></a><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">This is clever, in the sense that site collection and farm administrators do not have to worry about manually copying the files into the style library and master page gallery, but it&#8217;s still a manual task. In addition, as discussed in prior articles, this all depends on the &#8220;Office SharePoint Server Publishing Infrastructure&#8221; feature need to be active first.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Let&#8217;s see what happens, if it is not <strong>activated. </strong></font></span></p>
<h2>Breaking the rules <span style="font-size: 18pt; font-family: trebuchet ms"></span></h2>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Below, you can see that the publishing feature is not active. (The lack of ability to pick a new master page is a tell-tale sign).</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb4.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">To make 100% sure we are dealing with a clean site with no publishing, let&#8217;s examine the site in SharePoint Designer. Does a style library exist? Nah-uh!</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb5.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, first up, let&#8217;s see if <strong>our </strong>feature will install and activate.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb6.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">C:\&gt;stsadm -o installfeature -name PimpMySharePoint</font></span><span style="font-family: trebuchet ms"><br />
</span></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Operation completed successfully.</font></span><span style="font-family: trebuchet ms"><br />
</span></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">C:\wspbuilder&gt;</font></span></span><span style="font-size: 14pt"><span style="font-family: trebuchet ms"></span></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, what can we conclude from this? It seems feature dependencies do not prevent the <strong>installation</strong> of the feature to the server.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Ah, but of course, we all know by now that a feature has no effect until it&#8217;s activated. So, let&#8217;s do that next for a test site.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb7.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">GONG! We have a problem. Something went wrong!<br />
</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb8.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Now the error message here sucks in terms of readability, I wonder what list does not exist? The style library maybe?</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"><em>Failed to instantiate file &#8220;PimpMintyFresh.css&#8221; from module &#8220;MyPimpedStyles&#8221;: The specified list does not exist.   at Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)<br />
   at Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML</em><br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Looking closely at the message, it is saying that it tried to copy PimpMintyFresh.CSS to the location defined my the module MyPimpedStyles. As a refresher, here the the XML file containing the module directive.</font></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;Elements xmlns=&#8221;</font><a href="http://schemas.microsoft.com/sharepoint/"><span style="color: #669966; text-decoration: underline"><font size="2">http://schemas.microsoft.com/sharepoint/&#8221;</font></span></a><font size="2">&gt;<br />
    </font><font size="2"><strong>&lt;Module Name=&#8221;MyPimpedStyles&#8221; Url=&#8221;Style Library&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;       <br />
        &lt;File Url=&#8221;PimpMintyFresh.jpg&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
</strong>        &lt;File Url=&#8221;PimpMySharePoint.css&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;    <br />
[snip]</font></span><span style="font-family: trebuchet ms"><br />
</span></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">    &lt;/Module&gt;<br />
&lt;/Elements&gt;</font></span></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Can you see the &lt;module&gt; directive that has a parameter called &#8220;name&#8221; with a value of MypimpedStyles? The other parameter in &lt;module&gt; is the URL parameter, which for MypimpedStyles is &#8220;Style Library&#8221;.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">The error states &#8220;The specified list does not exist&#8221;, which means that there is no &#8220;Style Library&#8221;. Makes sense doesn&#8217;t it &#8211; as the publishing feature, not yet activated, has not created it?<br />
</font></span></p>
<h2>Okay let&#8217;s obey the rules then!</h2>
<p><span style="font-size: 18pt; font-family: trebuchet ms"><font size="2"><br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, after breaking it by trying our feature without its pre-requisites, let&#8217;s now be good children and activate the pre-requisite publishing feature before retrying this process.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Step 1. Activate the &#8220;Office SharePoint Server Publishing Infrastructure&#8221;</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">GONG! WHAT THE?&#8230; An error now!</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb9.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">The explanation is a hint&#8230;</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">&#8220;The specified name is already in use&#8221;</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">&#8230;and the full text version for uncle google <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </font></span></p>
<p><span style="font-family: trebuchet ms"><span style="font-size: 10pt">&#8220;A list, survey, discussion board, or document library cannot have the same name as another list, survey, discussion board, or document library in this Web site.  Use your browser&#8217;s Back button, and type a new name.   at Microsoft.SharePoint.Library.SPRequestInternalClass.CreateList(String bstrWebUrl, String bstrTitle, String bstrDescription, String bstrListUrl, String bstrFeatureId, Int32 lTemplateID, String bstrDocTemplateType, ListQuickLaunchOptions qlOpt)<br />
   at Microsoft.SharePoint.Library.SPRequest.CreateList(String bstrWebUrl, String bstrTitle, String bstrDescription, String bstrListUrl, String bstrFeatureId, Int32 lTemplateID, String bstrDocTemplateType, ListQuickLaunchOptions qlOpt) &#8220;</span></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So what could be causing this? Let&#8217;s look again at the site in SharePoint Designer.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">AHA! &#8211; A style library folder got created &#8211; nice error checking MS!<br />
</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb10.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">But this &#8220;Style library&#8221; must be a folder, not a document library because of the previous error message &#8220;The specified list does not exist&#8221;.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Anyway, the obvious thing to do is to delete this style library. So let&#8217;s do that using Designer and then re-attempt activating the publishing feature.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Aaah &#8230; That&#8217;s better!</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb11.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, for educational value, have a look at the site now in designer. As you can see below, the publishing feature adds a lot of stuff! If you want more detail on what the publishing feature adds to a site collection, check my </font><a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/"><span style="color: #669966; text-decoration: underline"><font size="2">first post</font></span></a><font size="2"> in this series or head over to </font><a href="http://www.mindsharpblogs.com/Penny/archive/2007/09/28/2973.aspx"><span style="color: #669966; text-decoration: underline"><font size="2">Penny&#8217;s</font></span></a><font size="2"> blog.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb12.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, although we have been clever in creating a feature for our branding, it&#8217;s just not darn clever enough. I wonder if we can make this better?</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">CleverWorkaround Rating &#8211; better than nothing<br />
</font></span></p>
<h2>Being Cleverer</h2>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">(is &#8216;cleverer&#8217; a word?)</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Another XML element that we can add to our FEATURE.XML is called, <strong>&#8220;ActivationDependencies&#8221;. </strong>MSDN explains it all but it&#8217;s pretty self explanatory anyway. Here is an example of an activationdependence for the publishing feature.</font></span></p>
<p><span style="font-size: 10pt; font-family: courier new">&lt;ActivationDependencies&gt;</span></p>
<p><span style="font-size: 10pt; font-family: courier new"></span><span style="font-size: 10pt; font-family: courier new">&lt;ActivationDependency FeatureId=&#8221;F6924D36-2FA8-4f0b-B16D-06B7250180FA&#8221;/&gt;</span><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span><span style="font-size: 10pt; font-family: courier new">&lt;/ActivationDependencies&gt;</span><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">How do we know that this is the Publishing Feature? The FeatureID refers to the GUID of the FEATURE.XML for that feature. (So now it should make sense why each feature needs a unique GUID).<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So here is the amended FEATURE.XML.</font></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;Feature Id=&#8221;01c34560-6561-11dc-8314-0800200c9a66&#8243;</font></span></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"></span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Title=&#8221;Pimp my SharePoint&#8221;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Description=&#8221;This is a feature that adds a new sexy CSS&#8221;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Version=&#8221;1.0.0.0&#8243;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Scope=&#8221;Site&#8221;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">xmlns=&#8221;http://schemas.microsoft.com/sharepoint/&#8221;&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;ActivationDependencies&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;ActivationDependency FeatureId=&#8221;F6924D36-2FA8-4f0b-B16D-06B7250180FA&#8221;/&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;/ActivationDependencies&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;ElementManifests&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;ElementManifest Location=&#8221;ProvisionedFiles.xml&#8221;/&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;/ElementManifests&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">&lt;/Feature&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span></p>
<h2>Backing out..</h2>
<p><span style="font-size: 18pt; font-family: trebuchet ms"></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, now we get to see one of the main benefits of features. The fact that they can be deactivated and uninstalled. The process is basically the reverse of the install/activate process. We deactivate the feature on all sites where it is used, and then we uninstall the feature. We then install our new feature.</font></span></p>
<p><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">C:\&gt;stsadm -o uninstallfeature -name pimpmysharepoint</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Operation completed successfully.</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">C:\&gt;stsadm -o installfeature -name pimpmysharepoint</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">Operation completed successfully.</font></span><span style="font-family: trebuchet ms"><br />
</span></span><span style="font-size: 14pt"><span style="font-family: courier new"><font size="2">C:\&gt;</font></span><span style="font-family: trebuchet ms"><br />
</span></span></p>
<h2>Reactivating</h2>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, now let&#8217;s activate our feature with this dependency information. That&#8217;s better&#8230; we get a friendly message that lists the feature by name (even though we only supplied the GUID).</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb13.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, we do as asked and activate the publishing feature. Now let&#8217;s re-attempt the install of our feature.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Yay</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb14.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, now we check the style library &#8211; all good!</font></span></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image16.png"><font size="2"><img border="0" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb15.png" /></font></a><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<h2>The next experiment</h2>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">At this point, I need to acknowledge the value of </font><a href="http://www.andrewconnell.com/blog/archive/2006/12/20/5451.aspx"><span style="color: #669966; text-decoration: underline"><font size="2">Andrew Connell&#8217;s</font></span></a><font size="2"> blog. We are going to discuss some interesting quirks in the next section, and his site was really useful.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, the next experiment. Let&#8217;s deactivate this feature and reactivate it to see what actually gets removed. Click deactivate against the pimpmysharepoint feature and accept the obligatory warning.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb16.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">It has deactivated ok.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, let&#8217;s check the style library again. Interesting &#8211; the files are still there. I initially thought that a feature would clean up after itself. But <a href="http://www.andrewconnell.com/blog/archive/2006/12/20/5451.aspx">Yoda Andrew</a>, sets the record straight.</font></span></p>
<p>&#8220;That is by design. Deactivation of features does not remove data that was created when the feature was activated. if you want to &#8220;clean up&#8221; the data that was created, you need to create a Feature receiver handler and have the FeatureDeactivating() event handler manually remove the file.&#8221;</p>
<p>and</p>
<p>&#8220;Keep in mind though, data is left in SharePoint BY DESIGN. What would happen if you had deployed a page layout with a Feature and someone removed it while it was in use by thousands of pages? Oops&#8230; blamo!&#8221;</p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Andrew has spoken &#8211; amen!</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, that left me wondering what happens when a feature is reactivated. Do newer files overwrite these orphans?</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Test 1: Update master page in the feature definition and reactivate</font></span></p>
<ul>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Update master page with small change and copy to the feature folder</font></span></li>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Deactivate the feature</font></span></li>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Check if the site still renders with the feature deactivated</font></span></span></li>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Uninstall the feature</font></span></li>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Install the Feature</font></span></li>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Reactivate the Feature</font></span></li>
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Re-Examine site. Master page changes are reflected</font></span></li>
</ul>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Test Passed!</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Test 2. Publish a master page as a major version in SharePoint designer and repeat test 1.</font></span></p>
<ul style="margin-left: 41pt">
<li><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Make a benign change and publish it as a major version<br />
</font></span></li>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb17.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></ul>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb18.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb19.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt"><span style="font-family: trebuchet ms"></span></span></p>
<ul>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Deactivate and uninstall feature</font></span></span></li>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Check if the site still renders with the feature deactivated</font></span></span></li>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Update the master page file and recreate the feature</font></span></span></li>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Reactivate the feature on the site collection</font></span></span></li>
<li><span style="font-size: 14pt"><span style="font-family: trebuchet ms"><font size="2">Check the site &#8211; the rendering does NOT reflect the updated master page in the feature.<br />
</font></span></span><span style="font-size: 14pt; font-family: trebuchet ms"></span></li>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Test Failed!</font></span></ul>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">The feature has <strong>not </strong>overwritten the master page on the site. Seems that as soon as a <strong>new version </strong>has been published, any updates via a feature <strong>will not overwrite</strong>. The feature gives no indication that this has occurred either! This is serious! So, how can we re-push out branding? T</font></span><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">his breaks the whole model. </font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Another bug? By design?</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">CleverWorkaround Rating: Shame, Shame, Shame<br />
</font></span></p>
<h2>More Gripes</h2>
<p><span style="font-size: 18pt; font-family: trebuchet ms"></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, I think to myself, what if I delete the master page from the gallery prior to deactivating, reinstalling and reactivating the feature? Sure, it defeats the purpose of feature based updates as it introduces a manual step, but maybe it will solve the problem.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">I tried and deleted it and I got this error.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb20.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Okay, makes sense. I forgot to set the master page of the site collection back to default.master or something else. So I did that and re-attempted.<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">GONG! Same issue! &#8211; Not having a good SharePoint day.</font></span></p>
<p><font size="2"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/102607-1713-sharepointb21.png" /></font><span style="font-size: 14pt; font-family: trebuchet ms"><br />
</span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Now, I will cut a long story short here and explain this bug to you. It&#8217;s a different one from the master page not being updated by the feature, but is just as annoying. </font></span><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">If you create a new site collection with no sub-sites, the master page above will delete just fine once you stop using it. But if you have made any sub-sites you may have this problem.</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">What seems to happen is this. If you make a <strong>sub-site</strong>, and then tell it to <strong>inherit the master page settings </strong>from the parent, AND then <strong>delete </strong>that sub-site, SharePoint seems to &#8216;forget&#8217; to update its internal status that the master page is no longer used for the deleted sub-site. Thus, you are prevented from deleting, when it is actually not in use. </font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"></span><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Check this KB article, it describes the issue but not the cause. </font><a href="http://support.microsoft.com/kb/926812"><span style="color: #669966; text-decoration: underline"><font size="2">http://support.microsoft.com/kb/926812</font></span></a></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, would you believe that in real life, I got nailed by both these two bugs at the same time! Made troubleshooting a real bitch I can tell you!</font></span></p>
<h2>Wrapping up</h2>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">So, to sum up, features are a &#8220;good thing&#8221; &#8482; and you should use them and also mandate their use. As I have demonstrated, they are beset by a couple of bugs that can give you a few more grey hairs, but once you are aware of this, they can be worked around with some governance rules. I hope, though, that Microsoft fix this rather soon &#8211; as it&#8217;s their bigger, enterprise customers who are more likely to be affected! (i.e. more sites, more people making changes, etc).<br />
</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">For what it&#8217;s worth, I found a workaround <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  which will be fully detailed in my <a href="http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/">next exciting installment</a> where I finish off features and finally dive into SOLUTIONS!</font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2">Bye for now! </font></span></p>
<p><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"><br />
 </font></span><span style="font-size: 14pt; font-family: trebuchet ms"><font size="2"><span style="font-size: 14pt; font-family: trebuchet ms"></span></font></span></p>
<p style="display: inline; margin: 0px; padding: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e5ba61f6-834b-47c8-9d02-087ee23143da" class="wlWriterSmartContent">del.icio.us Tags: <a rel="tag" href="http://del.icio.us/popular/SharePoint">SharePoint</a> , <a rel="tag" href="http://del.icio.us/popular/SharePoint%20Branding">SharePoint Branding</a> , <a rel="tag" href="http://del.icio.us/popular/Masterpages">Masterpages</a> , <a rel="tag" href="http://del.icio.us/popular/SharePoint%20Features">SharePoint Features</a></p>
<p style="display: inline; margin: 0px; padding: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:08826b5a-2d95-4272-a782-a167c3db7f51" class="wlWriterSmartContent">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/SharePoint/">SharePoint</a> , <a rel="tag" href="http://technorati.com/tags/SharePoint%20Branding/">SharePoint Branding</a> , <a rel="tag" href="http://technorati.com/tags/Masterpages/">Masterpages</a> , <a rel="tag" href="http://technorati.com/tags/SharePoint%20Features/">SharePoint Features</a></p>
<p><!--adsense--></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding Part 4 &#8211; Packaging up your masterpiece into a Feature</title>
		<link>http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 18:14:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[Governance]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[Branding Series 1]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/</guid>
		<description><![CDATA[Welcome to the fourth article in my series on SharePoint branding. Sorry for the time it&#8217;s taken to get this one out, but a certain game called “The Legend of Zelda:  Hourglass Phantom” on NDS got in the way. I finished it yesterday and only had to cheat via google once . Anyway it&#8217;s out [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p><!--adsense--></p>
<p class="MsoNormal">Welcome to the fourth article in my series on SharePoint branding. Sorry for the time it&#8217;s taken to get this one out, but a certain game called “The Legend of Zelda:  Hourglass Phantom” on NDS got in the way. I finished it yesterday and only had to cheat via google once <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Anyway it&#8217;s out of my system now so I can get back to this.</p>
<p class="MsoNormal">After 3 epic articles on all that painful CSS and master page stuff (part <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">one</a>, <a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">two</a> and <a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">three</a>), we now focus on what you have to do to get your branding masterpiece deployed to the SharePoint farm the clever way. In this next set of articles, we will look at where things should go, and then how to get it there the right way.</p>
<p class="MsoNormal"><span id="more-225"></span></p>
<p class="MsoNormal">Now web designers, put down that hairspray because I am talking to you! Don’t switch off just because we are shifting our focus to the packaging and deployment of your branding work. Just because you have produced a master page, CSS files and images does not mean your job is over. In my SharePoint world, you are expected at the very least, to also package your work into a feature so it can be deployed the clever way.</p>
<p class="MsoNormal">Technical geeks, stop sniggering because you are just as bad as the designers if not worse! Despite all your whining about process and documentation and how cowboy-like web designers are, you rarely do any documentation yourself and will happily make production changes with no change control or proper testing! <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> .</p>
<p class="MsoNormal">IT Managers… hmm&#8230; Why don’t you just go back to playing solitaire because I’m going to use some big words in this post.</p>
<p class="MsoNormal">Right! Let&#8217;s go.</p>
<p class="MsoNormal">Now I’ve already covered some of this stuff in my previous two articles on SharePoint features. We will recap some of this here, but I recommend for a full background, read the <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-%e2%80%9cfeatures%e2%80%9d-in-plain-english/">features post</a> and the <a href="http://www.cleverworkarounds.com/2007/10/08/a-simple-example-of-a-sharepoint-%e2%80%9cfeature%e2%80%9d/">feature example</a> post.</p>
<p class="MsoNormal">The CleverWorkarounds definition of SharePoint “Features” is that they provide a easy, consistent method to add/customise SharePoint. Once a feature has been <strong>installed</strong> to a SharePoint farm, it is available to be <strong>activated</strong> for specific sites or site collections. In the <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">first article</a> of this branding series, I showed how the “SharePoint Server Publishing Infrastructure” feature installs several master pages, among other things such as the style library. If you followed the advice in the first three articles on branding, it is exceedingly likely that you have your own customized master page, several CSS files and probably a few other associated files like images. You will also likely require the publishing feature to be activated for your branding to work.</p>
<p class="MsoNormal">So it makes sense, does it not, to package up and deploy your branding in the same manner as the publishing feature. Consistency is good!</p>
<p class="MsoNormal">So we will create a new feature that when activated for a site collection, adds our new master page, CSS and other supporting files to the master page gallery. From there, a site administrator can choose to use your marvelous custom master page by choosing it from the look and feel under “Site Administration”</p>
<p class="MsoNormal"><span><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/clip-image001.gif"><img v:shapes="_x0000_i1030" border="0" width="175" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/clip-image001-thumb.gif" alt="clip_image001" height="108" style="border-width: 0px" /></a></span></p>
<h2>The Custom Master Page</h2>
<p class="MsoNormal">In this post, I am going to use a mythical custom master page called PIMPMYSHAREPOINT.MASTER. This master page is based around my <a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">hybrid branding technique</a> as described in article 3. If you have not read this article yet, I suggest you go back and do so.</p>
<p class="MsoNormal">Anyway, this master page contains a custom reference to a CSS file called PIMPMYSHAREPOINT.CSS. Additionally, there are some other theme oriented CSS files that can be used for different skinning of sites. (In other words, site administrators have the choice of 3 color schemes to go with this master page).</p>
<ul>
<li>PimpMintyFresh.CSS</li>
<li>PimpBlingGold.CSS</li>
<li>PimpGothicBlack.CSS</li>
</ul>
<p>There are also several image files that go with each of these CSS files. To make this example easier, we will just use 1 image file for each of the skinning CSS files.</p>
<ul>
<li>PimpMintyFreshBack.JPG</li>
<li>PimpBlingGold.JPG</li>
<li>PimpGothicBlack.JPG</li>
</ul>
<p class="MsoNormal">So, along with PIMPMYSHAREPOINT.MASTER, we have 7 files here in total.</p>
<h2>So where do I put the files?</h2>
<p class="MsoNormal">Short answer, same place as the publishing feature uses for its master pages and styles. If that’s all you’re looking for, skip the next three headings, otherwise let’s dive a little deeper as to why they go here.</p>
<h2>I really want to know &#8211; where does the master page go?</h2>
<p class="MsoNormal">So we have our files, now we have to put them onto a site. Master page files obviously go in the master page gallery, but which one? A site collection has a master page gallery, but so does each and every individual <strong>site</strong> created <strong>inside</strong> that site collection. I can illustrate this by creating a site collection and a sub-site and then examining both of them in SharePoint designer. You will see that both the top level site of the site collection as well as the sub-site have individual <strong>_catalog/masterpage</strong> document libraries.</p>
<p class="MsoNormal">Below is the content of the master page gallery for the sub-site “blank” of the site collection “tidemo”. Note, there is not a lot in the master page gallery <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image4.png"><img border="0" width="238" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb4.png" alt="image" height="119" style="border-width: 0px" /></a></p>
<p class="MsoNormal">Now let’s look at the site collection (root) level. Whoa! The publishing feature puts a lot in there!</p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image5.png"><img border="0" width="482" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb5.png" alt="image" height="337" style="border-width: 0px" /></a></p>
<p class="MsoNormal">Okay, so we now know that we have two choices in relation to master page galleries. Which do we use? Fortunately, the answer is pretty much determined for us. Recall how by activating the publishing feature for a site collection, enables you the ability to choose a master page via the SharePoint “Site Settings” GUI interface. Guess what? When you have the publishing feature enabled and you choose a master page from “Look and Feel” of Site Settings, it always refers to the master page gallery for the <strong>site collection</strong>, not the site.</p>
<p class="MsoNormal">So the short answer is: put your master page in the <strong>master page gallery for the site collection</strong>. That way it is selectable via the GUI. It also means it is available to all sub sites. If you roll out an update to a master page in the site collection master page gallery, then sites in the site collection will reflect the change.</p>
<p class="MsoNormal">Now if you are clever and use something similar to the hybrid method for branding as described in part 3, it is fine to put all of the files in at a site collection level. This is because any new branding that you want to experiment with is just a new CSS file that can be deployed to the farm, and then can be referred to from the “alternate CSS URL” screen under “master page settings” in site administration. E.g.</p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image6.png"><img border="0" width="717" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb6.png" alt="image" height="212" style="border-width: 0px" /></a></p>
<p class="MsoNormal">But, I suppose there are valid circumstances where this central approach is not flexible enough. Let’s say, you have a particular site that you do not want to change at all when site collection updates are made to master pages and CSS files. In this case, you could copy the master page from the <strong>site collection</strong> master page gallery to the <strong>site</strong> master page gallery and edit the page layouts and default.aspx to refer to the site level master page gallery.</p>
<p class="MsoNormal">How? Well you would have to modify your layout and existing content pages and change the <tt><span style="font-size: 10pt">~masterurl </span></tt>token that is used by default, to something else. (I spoke about tokens in the “<a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">master page theory</a>” section of <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">part 1</a> and won’t rehash it here). But changing ~masterurl/default.master to ~site/_catalogs/masterpages/&lt; your master page file&gt; will do the trick. It does hard-code the name of the master page. It <strong>will</strong> reference the master page from the master page gallery of the <strong>site</strong> and <strong>not</strong> the site collection.</p>
<p class="MsoNormal">I haven’t had the need to actually change the token as described above, so I’ll reserve judgement on its CleverWorkaround rating for now..</p>
<p class="MsoNormal">For the record.. I’d recommend <a href="http://blog.spsclerics.com/Lists/Posts/Post.aspx?List=66c85794%2D9b8a%2D47bb%2D8c55%2Da1cd43c6c8c0&amp;ID=24">Stramit’s page</a> for a more detailed explanation of the tokens.</p>
<h2>Ok, so where do the CSS and supporting files go?</h2>
<p class="MsoNormal">This next bit can be tricky. Why? Because it all depends on how you set up your master page in the first place. We spent article 2 and 3 looking at methods to have a master page reference a CSS file. You can hard-code a reference to a CSS link into a master page directly or using methods like CssRegistration. Either way, if you do not use tokens here, you will get yourself into trouble. Consider the following master page source code:</p>
<p class="MsoNormal"><span courier="courier" new??="new??"><font face="Courier New">&lt;head runat=&#8221;server&#8221;&gt;<br />
[snip]<br />
&lt;Sharepoint:CssLink runat=&#8221;server&#8221; /<br />
&lt;!–Styles used for positioning, font and spacing definitions–&gt;<br />
</font><font face="Courier New"><strong>&lt;SharePoint:CssRegistration name=&#8221;&lt;/Style Library/pimpmysharepoint.css&gt;&#8221; runat=&#8221;server&#8221;/&gt;<br />
</strong>[snip]<br />
&lt;/head&gt;</font></span>
</p>
<p class="MsoNormal">As you can see where I have marked in bold, it expects a document library to exist called “Style Library and looks inside it for a file called pimpmysharepoint.css”. This will result in the following browser HTML</p>
<p class="MsoNormal"><span courier="courier" new??="new??"><font face="Courier New">&lt;head&gt;<br />
[snip]<br />
&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/Style%20Library/pimpmysharepoint.css&#8221; mce_href=&#8221;/Style%20Library/pimpmysharepoint.css&#8221;/&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/_layouts/1033/styles/core.css&#8221; mce_href=&#8221;/_layouts/1033/styles/core.css&#8221;/&gt;<br />
[snip]<br />
&lt;/head&gt;</font></span>
</p>
<p class="MsoNormal">Now if this is a single top level site collection, we are fine and dandy. The publishing feature does indeed create a document library called “Style Library” and it is the recommended place to put CSS files (more on this later).</p>
<p class="MsoNormal">But don’t forget, a single SharePoint web application can have many hundreds of site collections. Consider this example:</p>
<ul>
<li>http://tidemo</li>
<li>http://tidemo/sites/collection1</li>
<li>http://tidemo/sites/collection2</li>
</ul>
<p class="MsoNormal">Above are 3 separate site collections running from a single web application. Now what if you as a user, only have permission to access http://tidemo/sites/collection1?</p>
<p class="MsoNormal"><span> </span>As shown above, the master page will render the CSS link as</p>
<p class="MsoNormal"><span courier="courier" new??="new??"><font face="Courier New">&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/Style%20Library/pimpmysharepoint.css&#8221; mce_href=&#8221;/Style%20Library/pimpmysharepoint.css&#8221;/&gt;</font></span></p>
<p class="MsoNormal">Can you see the issue with this? It will try and grab the CSS file from http://tidemo/style library, not http://tidemo/sites/collection1/style library. But your user account has no permission to http://tidemo at all. So the CSS is not found and the page is not styled.</p>
<p class="MsoNormal">Fortunately there are tokens that you can use to make sure there is a reference to the specific site collection. It is named, strangely enough, ~SiteCollection. So here is the amended master page source</p>
<p class="MsoNormal"><span courier="courier" new??="new??"><font face="Courier New">&lt;head runat=&#8221;server&#8221;&gt;<br />
[snip]<br />
&lt;Sharepoint:CssLink runat=&#8221;server&#8221; /<br />
&lt;!–Styles used for positioning, font and spacing definitions–&gt;<br />
&lt;SharePoint:CssRegistration name=&#8221;&lt;% $SPUrl:~SiteCollection/Style Library/pimpmysharepoint.css%&gt;&#8221; runat=&#8221;server&#8221;/&gt;<br />
[snip]<br />
&lt;/head&gt;</font></span>
</p>
<p class="MsoNormal">Resulting in this output for our above example:</p>
<p class="MsoNormal"><span courier="courier" new??="new??"><font face="Courier New">&lt;head&gt;<br />
[snip]<br />
&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/sites/collection1/Style%20Library/pimpmysharepoint.css&#8221; mce_href=&#8221;/sites/collection1/Style%20Library/pimpmysharepoint.css&#8221;/&gt;<br />
&lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;/_layouts/1033/styles/core.css&#8221; mce_href=&#8221;/_layouts/1033/styles/core.css&#8221;/&gt;<br />
[snip]<br />
&lt;/head&gt;</font></span>
</p>
<p class="MsoNormal">The problem is now solved. Note the path reflects the current site collection /sites/collection1.</p>
<p class="MsoNormal">So, now that we have tokens out of the way, we can quickly touch on the “Style Library” document library itself. As previously mentioned it is installed by the publishing feature and all CSS styles and associated files are stored here. Unlike the master page gallery, it only exists at the site collection level (because publishing is a site collection scoped feature). It is version enabled like the master page gallery but by default, does not have content approval enabled. It has been structured to handle multilingual sites via the use of subfolders for a given language and a language related token that is usable within master pages.</p>
<p class="MsoNormal">So, unless you have a really good reason, the CleverWorkarounds recommendation is to stick the style library created by the publishing feature. Add your custom styles to it using a naming convention that will ensure that future branding features by Microsoft or 3<sup>rd</sup> parties will not inadvertently overwrite your own stuff.</p>
<p class="MsoNormal">As mentioned above, a key reason to stick with the default style library is the multilingual framework it provides, which we will touch on next.</p>
<h2>Multilingual CSS considerations</h2>
<p class="MsoNormal">Multilingual support is very important in the enterprise. It is common to have some unique CSS styling requirements for particular languages so the style library structure, in combination with some tokens enables you to achieve this in a clever way.</p>
<p class="MsoNormal">Let&#8217;s look at a snippet of the structure of Style library as it is created by the publishing feature. Below is a directory listing of the style library.</p>
<ul>
<li><span courier="courier" new??="new??">\Style Library\zz1_Blue.css</span></li>
</ul>
<p><span courier="courier" new??="new??">[snip]</span></p>
<ul>
<li><span courier="courier" new??="new??">\Style Library\Forms\Document</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\Tabs.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\Controls.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\rca.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\PageLayouts.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\zz2_EditMode.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\Vertical.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\SingleLevel.css</span></li>
<li><span courier="courier" new??="new??">\Style Library\en-us\Core Styles\Band.css</span></li>
</ul>
<p><span courier="courier" new??="new??">[snip]</span></p>
<ul>
<li><span courier="courier" new??="new??">\Style Library\Images\blk_PageBackground.jpg</span></li>
<li><span courier="courier" new??="new??">\Style Library\Images\blk_logo.jpg</span></li>
</ul>
<p>Note, there is a folder called “en-us”, and within that are some additional styles. If you examine the sample master pages, you will see references to these styles in this format:</p>
<p class="MsoNormal"><font face="Courier New"><span courier="courier" new??="new??">&lt;SharePoint:CssRegistration name=&#8221;&lt;% $SPUrl:~SiteCollection/Style Library/<strong>~language</strong>/Core Styles/Band.css%&gt;&#8221; runat=&#8221;server&#8221;/&gt;</span> </font></p>
<p><span courier="courier" new??="new??"><font face="Courier New">&lt;SharePoint:CssRegistration name=&#8221;&lt;% $SPUrl:~sitecollection/Style Library/<strong>~language</strong>/Core Styles/controls.css %&gt;&#8221; runat=&#8221;server&#8221;/&gt;</font></span></p>
<p>We now see two new tokens. ~SiteCollection which we have already seen and ~language. ~language is pretty obvious I think. It substitutes the current locale to create the path. Therefore, if you had to support an additional language in your branding, all you need do is create a folder in the Style library, named the same as the locale/language being used. SharePoint will create the path on the fly and render the language specific CSS file.</p>
<p class="MsoNormal">CleverWorkaround rating: Too easy!</p>
<h2>Enough theory already! Let’s package up our branding.</h2>
<p class="MsoNormal">Well.. as it turns out, I wrote an article on creating a feature some time back. I’ll regurgitate some of it here, but using the PIMPMYSHAREPOINT.MASTER example above.</p>
<p>All features live in a folder on the web front end server.</p>
<p><span courier="courier" new??="new??"><font face="Courier New">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES </font></span></p>
<p>To create a new feature, all you need to do is create a new folder under here. Until you activate the feature, this folder will have no effect on the system. Let’s call this feature folder “PimpMySharePoint”</p>
<p><font face="Courier New"><span courier="courier" new??="new??">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\PimpMySharePoint</span> </font></p>
<p>Inside this folder we place our master page, 3 CSS files and 3 images as shown below</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image7.png"><img border="0" width="731" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb7.png" alt="image" height="252" style="border-width: 0px" /></a></p>
<p>So, now we need to do the glue that when the feature is activated after being installed, will copy these files into their correct locations in the site collection . We have to create 2 XML files that do this work.</p>
<p>The first XML file is always called FEATURE.XML.</p>
<h2>Feature.XML</h2>
<p>Now in real life, you will copy a FEATURE.XML from one of the many other features here and work off that. But in our case, we will just type it in. The content of FEATURE.XML is below:</p>
<p><span courier="courier" new??="new??"><font face="Courier New">&lt;Feature Id=&#8221;01c34560-6561-11dc-8314-0800200c9a66″  <br />
Title=&#8221;Pimp my SharePoint&#8221;  <br />
Description=&#8221;This is a feature that adds a new sexy CSS&#8221;  <br />
Version=&#8221;1.0.0.0″  <br />
Scope=&#8221;Site&#8221;  <br />
xmlns=&#8221;</font></span><a href="http://schemas.microsoft.com/sharepoint/"><span courier="courier" new??="new??"><font face="Courier New">http://schemas.microsoft.com/sharepoint/&#8221;</font></span></a><span courier="courier" new??="new??"><font face="Courier New">&gt;  <br />
&lt;ElementManifests&gt;       <br />
    &lt;ElementManifest Location=&#8221;ProvisionedFiles.xml&#8221;/&gt;  <br />
&lt;/ElementManifests&gt;<br />
&lt;/Feature&gt;</font></span></p>
<p>So inside this XML file, we have a &lt;feature&gt; element and inside that an &lt;elementmanifests&gt; element. SharePoint examines this XML file when installing the feature.</p>
<p>The required parameters for the &lt;feature&gt; element are below (lifted straight from <a target="_blank" href="http://msdn2.microsoft.com/en-us/library/ms436075.aspx">MSDN</a>)</p>
<table border="0" cellPadding="0" cellSpacing="0" style="border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Attribute</span></strong><span style="font-size: 12pt"></span></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Description</span></strong></p>
</td>
</tr>
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Description</span></strong><span style="font-size: 12pt"></span></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Optional String</span></strong>. Returns a longer representation of what the Feature does.<span style="font-size: 12pt"></span></p>
</td>
</tr>
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Id</span></strong></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Required Text</span></strong>. Contains the globally unique identifier (GUID) for the Feature.<span style="font-size: 12pt"></span></p>
</td>
</tr>
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Scope</span></strong></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Required Text</span></strong>. Can contain one of the following values: Farm (farm), WebApplication (Web application), Site (site collection), Web (Web site).</p>
</td>
</tr>
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Title</span></strong><span style="font-size: 12pt"></span></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Optional Text</span></strong>. Returns the title of the Feature. Limited to 255 characters.<span style="font-size: 12pt"></span></p>
</td>
</tr>
<tr>
<td width="107" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Version</span></strong><span style="font-size: 12pt"></span></p>
</td>
<td width="663" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Optional Text</span></strong>. Specifies a System.Version-compliant representation of the version of a Feature. This can be up to four numbers delimited by decimals that represent a version.<span style="font-size: 12pt"></span></p>
</td>
</tr>
</table>
<p>So, the first thing to do is generate a GUID. You can do this a number of ways, but I typically use an online generator like the one <a href="http://www.famkruithof.net/uuid/uuidgen">here</a> to do it. My GUID from the online generator is:  <em><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">01c34560-6561-11dc-8314-0800200c9a66</span></em>. Feel free to use it for this example but you should substitute with your own.</p>
<p>The “Title” and “description” parameters should be plainly obvious and “version” is optional, but whack it in anyway. “Scope” is important, a feature can be activated at various points in the farm. &#8220;Site&#8221; means it is activated once per site collection. All sub-sites under this site collection can make use of the feature without having to activate it. This will become clear later.</p>
<p>Next we refer to an &lt;element manifest&gt;. This is a reference to another XML file that actually tells SharePoint what to do when this feature is activated on a site collection. (I have called the XML file<span>  </span>PROVISIONEDFILES.XML but you can call it anything you like.</p>
<h2>The Element Manifest File</h2>
<p>Let’s take a closer look at the element manifest file called ProvisionedFiles.XML since it does all the grunt work of copying the files into the right locations on the site collection.</p>
<p><span courier="courier" new??="new??"><font face="Courier New">&lt;Elements xmlns=&#8221;</font></span><a href="http://schemas.microsoft.com/sharepoint/"><span courier="courier" new??="new??"><font face="Courier New">http://schemas.microsoft.com/sharepoint/&#8221;</font></span></a><font face="Courier New"><span courier="courier" new??="new??">&gt;<br />
    &lt;Module Name=&#8221;MyPimpedMasterPage&#8221; Url=&#8221;_catalogs/masterpage&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;       <br />
        &lt;File Url=&#8221;PimpMySharePoint.master&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
    &lt;/Module&gt;<br />
    &lt;Module Name=&#8221;MyPimpedStyles&#8221; Url=&#8221;Style Library&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;       <br />
        &lt;File Url=&#8221;PimpMySharePoint.css&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpMintyFresh.css&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpBlingGold.css&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpGothicBlack.css&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpMintyFresh.jpg&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpBlingGold.jpg&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
        &lt;File Url=&#8221;PimpGothicBlack.jpg&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;   <br />
    &lt;/Module&gt;<br />
&lt;/Elements&gt;</span> </font></p>
<p>So as you can see in the above XML file, we have used an XML element called MODULE twice. One contains 1 FILE element – the master page. The other contains 7 FILE elements – one for each CSS and image file in the branding.</p>
<p>So what the heck is MODULE anyway? Well, it is one of several elements that you can use in an element manifest file to perform particular administrative installation actions. Here is list of the common things that a feature may install/create:</p>
<ul type="disc">
<li style="tab-stops: list 36.0pt" class="MsoNormal">Content Types: Contains a definition of a SharePoint content type.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Content Type Binding: Actually applies a content type to a document library.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Control: Allows you to replace existing controls on the page, such as the search or navigation with your own custom control.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Custom Action: You can define custom actions such as add a new menu item in &#8220;Site Actions&#8221;.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Feature/Site Template Association: This allows you to bind a feature to a site template so that the feature is included in new sites based on that template.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Field: Contains a field, or column definition that can be reused in multiple lists.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Hide Custom Action: Opposite to &#8220;Custom Action&#8221;, where you want to hide menu items.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">List Instance: Provisions a SharePoint site with a list which includes specific data.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">List Template: A list definition or template, which defines a list that can be provisioned to a SharePoint site.</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal"><strong>Module: Deploys files which are included when provisioning sites. </strong></li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Receiver: Defines an event handler for a list, or document library</li>
<li style="tab-stops: list 36.0pt" class="MsoNormal">Workflow: Defines a workflow for a list, or document library.</li>
</ul>
<p style="tab-stops: list 36.0pt" class="MsoNormal">So what do we have third from the bottom? Why it’s a “MODULE” element! What does it do? “Deploys files which are included when provisioning sites”. Eureka!</p>
<p>Now let’s examine the &lt;MODULE&gt; and its child element &lt;FILE&gt; element in more detail.</p>
<p><span courier="courier" new??="new??">&lt;Module Name=&#8221;MyPimpedStyles&#8221; Url=&#8221;Style Library&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;        </span></p>
<table border="1" cellPadding="0" cellSpacing="0" style="border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="138" style="width: 103.5pt; padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Module Element</span></strong></p>
</td>
<td width="868" style="width: 651pt; padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Description</span></strong></p>
</td>
</tr>
<tr>
<td width="138" style="width: 103.5pt; padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Name</span></strong></p>
</td>
<td width="868" style="width: 651pt; padding: 0.75pt">
<p class="MsoNormal">Required Text. Contains the name of the file set.</p>
</td>
</tr>
<tr>
<td width="138" style="width: 103.5pt; padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">RootWebOnly</span></strong></p>
</td>
<td width="868" style="width: 651pt; padding: 0.75pt">
<p class="MsoNormal">Optional Boolean. TRUE if the files specified in the module are installed only in the top-level Web site of the site collection.</p>
</td>
</tr>
<tr>
<td width="138" style="width: 103.5pt; padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Url</span></strong><span style="font-size: 12pt"></span></p>
</td>
<td width="868" style="width: 651pt; padding: 0.75pt">
<p class="MsoNormal">Optional Text. Specifies the virtual path of the folder in which to place the files when a site is instantiated. If Path is not specified, the value of Url is used for the physical path. Use the Url attribute to provision a folder through the Feature.</p>
</td>
</tr>
</table>
<p class="MsoNormal"><span courier="courier" new??="new??"></span></p>
<p class="MsoNormal"><span courier="courier" new??="new??">&lt;File Url=&#8221;PimpMySharePoint.master&#8221; Type=&#8221;GhostableInLibrary&#8221; /&gt;</span></p>
<table border="1" cellPadding="0" cellSpacing="0" style="border-collapse: collapse" class="MsoNormalTable">
<tr>
<td width="142" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">File</span></strong><br />
<strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Element</span></strong></p>
</td>
<td width="628" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Description</span></strong></p>
</td>
</tr>
<tr>
<td width="142" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">IgnoreIfAlreadyExists</span></strong></p>
</td>
<td width="628" style="padding: 0.75pt">
<p class="MsoNormal">Optional Boolean. TRUE to provision the view even if the file already exists at the specified URL; otherwise, FALSE.</p>
</td>
</tr>
<tr>
<td width="142" style="padding: 0.75pt">
<p class="MsoNormal"><strong><span calibri?,?sans-serif?;="calibri?,?sans-serif?;" mso-bidi-font-family:="mso-bidi-font-family:" ?Times="?Times" New="New" Roman?;="Roman?;" mso-ascii-theme-font:="mso-ascii-theme-font:" mso-hansi-theme-font:="mso-hansi-theme-font:" minor-latin;="minor-latin;" mso-bidi-theme-font:="mso-bidi-theme-font:" minor-bidi?="minor-bidi?">Type</span></strong></p>
</td>
<td width="628" style="padding: 0.75pt">
<p class="MsoNormal">Optional Text. Specifies that the file be cached in memory on the front-end Web server. Possible values include Ghostable and GhostableInLibrary. Both values specify that the file be cached, but GhostableInLibrary specifies that the file be cached as part of a list whose base type is Document Library.When changes are made, for example, to the home page through the UI, only the differences from the original page definition are stored in the database, while default.aspx is cached in memory along with the schema files. The HTML page that is displayed in the browser is constructed through the combined definition resulting from the original definition cached in memory and from changes stored in the database.</p>
</td>
</tr>
</table>
<p>So, in CleverWorkarounds english, the &lt;module&gt; section is specifying the location that any &lt;file&gt; elements be copied to. For each file to be copied, there is a corresponding &lt;file&gt; element. We discussed in the previous section on file locations, that master pages will reside in the <strong>_catalogs/masterpage</strong> library (the master page gallery). Styles will reside in the “Style Library” document library,</p>
<p>Since we have two locations, we have two &lt;module&gt; entries for the master page gallery and style library.</p>
<p><span courier="courier" new??="new??">    &lt;Module Name=&#8221;MyPimpedMasterPage&#8221; Url=&#8221;_catalogs/masterpage&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;       <br />
    &lt;Module Name=&#8221;MyPimpedStyles&#8221; Url=&#8221;Style Library&#8221; RootWebOnly=&#8221;TRUE&#8221;&gt;        </span></p>
<p>So, according to the element manifest for our custom feature, we will copy the files:</p>
<ul>
<li>PimpMySharePoint.CSS</li>
<li>PimpMintyFresh.CSS</li>
<li>PimpBlingGold.CSS</li>
<li>PimpGothicBlack.CSS</li>
<li>PimpMintyFreshBack.JPG</li>
<li>PimpBlingGold.JPG</li>
<li>PimpGothicBlack.JPG</li>
</ul>
<p>To the Style Library and we will copy:</p>
<ul>
<li>PimpMySharePoint.Master</li>
</ul>
<p>To the master page gallery.</p>
<p>That’s it for the feature file. Let&#8217;s test that it works!</p>
<h2>Installing the Feature</h2>
<p>So here is our feature folder again with the 2 XML files described in the previous sections.</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image9.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb10.png" alt="image" height="245" style="border-width: 0px" /></a></p>
<p class="MsoNormal">Installing the feature now is pretty easy. <span>It is best done via opening up a command prompt on each SharePoint web front end server on the farm. Then we use the STSADM command to do the deed via the “STSADM –o installfeature” command.</span> This command takes a couple of parameters.</p>
<p class="MsoNormal">Use either the <strong>-name</strong> or the <strong>-filename</strong> argument to select a feature.</p>
<p class="MsoNormal">Use <strong>-force</strong> to install the feature even if it is already installed and activated somewhere in the farm</p>
<p class="MsoNormal"><span>When the -name parameter is specified, SharePoint knows to look in the TEMPLTE\FEATUIRES folder already, so you do not have to specify a full path.</span> For example:</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image10.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb11.png" alt="image" height="323" style="border-width: 0px" /></a></p>
<h2><span>Testing the installation </span></h2>
<p class="MsoNormal">Okay, so the feature is installed. Now what? Now we need to activate this feature on a site collection. Here is the &#8220;Style Library&#8221; of my test site. (Remember that this library will not exist unless the SharePoint Publishing Infrastructure feature has been installed). Note that at this time, there is no CSS files called PIMP*.CSS</p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image11.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb12.png" alt="image" height="304" style="border-width: 0px" /></a></p>
<p>So now let’s Activate the feature. Browse to Site Actions&gt;Site Settings and from the Site Collection Administration menu, choose &#8220;Site Collection Features&#8221;. Lo&#8217; and behold! We have our feature listed! Note the title and description is as per our FEATURE.XML file.</p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image12.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb13.png" alt="image" height="40" style="border-width: 0px" /></a></p>
<p class="MsoNormal">Click &#8220;Activate&#8221; to activate the feature (you can also do this on the command line via STSADM -o activatefeature command). Once it is marked as active, re-examine the style library. Woo freakin&#8217; hoo! There are our CSS files!</p>
<p class="MsoNormal"><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image13.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb14.png" alt="image" height="368" style="border-width: 0px" /></a></p>
<p>And the master page gallery? YES! It&#8217;s there (amongst all the other stuff the publishing feature puts there).</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image14.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb15.png" alt="image" height="416" style="border-width: 0px" /></a></p>
<h3></h3>
<h2>Testing the Feature</h2>
<p>In our example here, we can test this feature by choosing the new master page from the look and feel section of site settings.</p>
<p><span><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/clip-image001.gif"><img v:shapes="_x0000_i1030" border="0" width="175" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/clip-image001-thumb.gif" alt="clip_image001" height="108" style="border-width: 0px" /></a></span></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image15.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb16.png" alt="image" height="241" style="border-width: 0px" /></a></p>
<p>Then, once we have chosen PIMPMYSHAREPOINT.MASTER, we can choose one of the theme CSS files to use with it in the same page as above, just further down.</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image16.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb17.png" alt="image" height="311" style="border-width: 0px" /></a></p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image17.png"><img border="0" width="644" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/image-thumb18.png" alt="image" height="127" style="border-width: 0px" /></a> .</p>
<h2>Are we done then?</h2>
<p class="MsoNormal">So if you have gotten this far, thanks (no really… thanks) for sticking with me. I know this is a hard slog, but trust me, it will save you some heartache.</p>
<p class="MsoNormal">Now if you are working on a single server farm, or a smallish farm, then you may well be done. Unfortunately, for many however, we are not done yet! (aw crap – you think after 4 really long winded articles I’d finally be finished but noooo.. SharePoint is a complex beast and there is still more to go in this area.)</p>
<p class="MsoNormal">So in the <a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">next article</a>, I will delve into how you can improve this feature by having the master page automatically selected when it is activated, then how to go about upgrading a feature, some of the quirks and dare I say it, bugs, that currently exist around branding and packaging, as well as when and why a feature should be incorporated into a SharePoint solution.</p>
<p class="MsoNormal">Cheers</p>
<p><!--adsense--></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding &#8211; How CSS works with master pages &#8211; Part 3</title>
		<link>http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 00:00:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[Branding Series 1]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/</guid>
		<description><![CDATA[Welcome to the third article (or is it a manifesto?) in my series on SharePoint branding. In this article, we continue examining methods to incorporate CSS files into master pages for clever branding. In my first article of this topic, I discussed what I think is the main issue with SharePoint branding &#8211; APPLICATION.MASTER and [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p><!--adsense--></p>
<p>Welcome to the third article (or is it a manifesto?) in my series on SharePoint branding. In this article, we continue examining methods to incorporate CSS files into master pages for clever branding. In my first article of this topic, I discussed what I think is the main issue with SharePoint branding &#8211; <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">APPLICATION.MASTER and CORE.CSS</a>. The previous article to this one, examined <a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">5 methods</a> to deal with the trial and tribulations of <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">APPLICATION.MASTER and CORE.CSS behavior</a>. So, to recap where we got to, let&#8217;s re-examine the original scenario and then look at the summary of the 5 different several methods with their relative merits and issues.</p>
<h2>The Scenario</h2>
<p>Like many organizations, my client had an existing corporate branding standard that was used in a non SharePoint environment and naturally enough, they wanted their SharePoint site to look like this branding. This was for a fully featured intranet/extranet that utilized most of the MOSS2007 features such as</p>
<ul>
<li>Document collaboration </li>
<li>Infopath Forms Services </li>
<li>Workflow </li>
<li>Enterprise Search </li>
<li>Excel services </li>
<li>Business Data Catalog </li>
<li>Custom web parts </li>
<li>Event Handlers </li>
</ul>
<p>It was *not* a public site at all.</p>
<p>Initial investigation soon concluded that we would need a custom master page. DEFAULT.MASTER didn&#8217;t quite have the design flexibility that was required. In fact the branding requirements were actually closer to some of the built in master pages such as BLUEGLASS.MASTER, since this was for intranet purposes, particularly collaborative document management, those master pages are unsuitable.</p>
<p><span id="more-154"></span></p>
<p>Other major requirements included mandatory consistency of branding across the entire farm. This meant that we had to deal with the APPLICATION.MASTER issue. Additionally, different semi-autonomous divisions within the client&#8217;s organisation wanted to be able to modify the corporate brand in accordance with existing branding policy (mainly colours/skinning) while maintaining the existing structural look and feel.</p>
<p>Additionally, as well as the corporate branding, there was another, very different branding which was used as part of a communications plan for some organizational change stuff. This had a deliberately different look to the rest of the site, yet the web designer had been clever when this design was created. They were able to completely rebrand the look and feel of the additional branding just through additional CSS and not wholesale HTML structural changes.</p>
<p>So, really, we had two general classes of sites. &#8216;Standard&#8217; corporate sites and the custom branded &#8216;Organisational Change&#8217; site.</p>
<p>The type of MOSS environment this was to be applied to was a medium to large SharePoint farm with three web front end (WFE) servers, and there were several SharePoint web applications and site collections in the farm that needed this branding. Further down the track, there was to be other SharePoint farms in different offices around the world with localized language requirements.</p>
<p>The final requirement (the one that complicated things) was that many of the CORE.CSS styles needed to be overridden to ensure the branding was correct.</p>
<h2>Summary of CSS methods</h2>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Method</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Advantages</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Disadvantages</strong></td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">SharePoint:CSSRegistration</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not overrides core.css         <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Master Page Settings</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement         <br />- Overrides core.css          <br />- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Can only be used once         <br />- Has to be set up for each site</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">&lt;link&gt; method</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once         <br />- Overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Precludes &quot;Master Page Settings&quot; CSS override         <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Michael&#8217;s webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once         <br />- Overrides core.css          <br />- Works nicely with &quot;Master Page Settings&quot; CSS override</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages         <br />- core.css as the first CSS can be problematic</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">My webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once         <br />- Overrides core.css          <br />- Works nicely with &quot;Master Page Settings&quot; CSS override          <br />- core.css is not the first stylesheet in the list          <br />- allows choice as to what css overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages</td>
</tr>
</tbody>
</table>
<p>Now for many SharePoint logical architectures, these methods will likely work well. Unfortunately in my situation each had enough drawbacks that I kept looking. So next stop: SharePoint Themes.</p>
<h2>Over-riding CSS &#8211; SharePoint Themes</h2>
<p>In my humble opinion, when you examine themes, it smells a little like legacy WSS/SharePoint 2 functionality carried over and now adds to confusion rather than clarifies. This is purely a hunch of course, but given the way themes have to be installed, and their scope across the farm, suggests to me that it may become a legacy feature going forward.</p>
<p>Why do I think this? Well, the official purpose a SharePoint theme is for &#8216;skinning&#8217; a site, but at the end of the day, a theme is just another CSS file, only implemented a different way. Being CSS, you can define any style you want here, not just the ones related to colour. Furthermore, the styles defined in themes can be used in any other other CSS files too.</p>
<p>Okay, so it is essentially another form of CSS file&#8230; then what is the difference between this and the other methods CSS I have outlined?</p>
<p>Well, for a start, theme CSS files live in a sub-folder of on the server:</p>
<p><span style="font-size: 10pt; font-family: courier new">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES </span></p>
<p>So, this is a location on the web front end server/servers, whereas with the other methods, the CSS files reside inside a document library of a site collection. I believe that document library is a better choice because you have all those niceties like versioning, approvals and recycle bin, etc. If you have a farm of WFE servers, you would have to add your theme to each server and hope no mistake was made.</p>
<p>On top of being in every WFE server folder, just making a CSS file and dropping it in here is not enough either. Examining one of the pre-supplied themes shows that a theme consists of CSS files, an INF file, and of course, the images referred to by the styles. The two CSS files are called THEME.CSS and MOSSEXTENSION.CSS. (<em>When you apply a theme to a site, MOSSextension.css is appended to the bottom of your theme.css</em>)</p>
<p>The INF file is always the name of the theme folder, eg</p>
<p>&lt;path to sharepoint&gt;\12\TEMPLATE\THEMES\CITRUS contains CITRUS.INF</p>
<p>So you create a folder, add the CSS, INF and images, and finally, you then have to tell SharePoint about it. This is done by modifying a single XML file called SPTHEMES.XML.</p>
<p>SPTHEMES.XML can be found in:</p>
<p><span style="font-size: 10pt; font-family: courier new">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033 </span></p>
<p>A typical entry will look like:</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Templates</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">TemplateID</span><span class="kwrd">&gt;</span>PimpMySharePoint<span class="kwrd">&lt;/</span><span class="html">TemplateID</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">DisplayName</span><span class="kwrd">&gt;</span>Pimp me<span class="kwrd">&lt;/</span><span class="html">DisplayName</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Description</span><span class="kwrd">&gt;</span>A pimped sharepoint<span class="kwrd">&lt;/</span><span class="html">Description</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Thumbnail</span><span class="kwrd">&gt;</span>images/thpimp.gif<span class="kwrd">&lt;/</span><span class="html">Thumbnail</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Preview</span><span class="kwrd">&gt;</span>images/thvpimp.gif<span class="kwrd">&lt;/</span><span class="html">Preview</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">templates</span><span class="kwrd">&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>So let&#8217;s look at an example.</p>
<p>I have taken a copy of the CLASSIC folder under THEMES, info a folder called PIMPMySharePoint. I&#8217;ve then renamed CLASSIC.INF to PIMPMYSHAREPOINT.INF and added this theme to SPTHEMES.XML.</p>
<p>I then run IISRESET and open up my site collection. Go to Site Actions-&gt;Site Settings and choose &quot;Site Theme&quot;</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/09/image2.png"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/09/image-thumb2.png" border="0" /></a></p>
<p>Now you should see your &quot;Pimp SharePoint&quot; theme listed</p>
<p><a href="http://www.cleverworkarounds.com/wp-content/uploads/2007/09/image3.png"><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/09/image-thumb3.png" border="0" /></a></p>
<p>Click apply and re-examine the page. You will see that the look and feel of the site will have changed.</p>
<p>Now examine the HTML source in the browser. You will see something like</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/controls.css?rev=EhwiQKSLiI%2F4dGDs6DyUdQ%3D%3D&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/HtmlEditorCustomStyles.css?rev=8SKxtNx33FmoDhbbfB27UA%3D%3D&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/HtmlEditorTableFormats.css?rev=guYGdUBUxQit03E2jhSdvA%3D%3D&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span>&quot;<span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">id</span><span class="kwrd">=&quot;onetidThemeCSS&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/ft1/_themes/PimpSharePoint/Pimp1011-65001.css?rev=12%2E0%2E0%2E6007&quot;</span><span class="kwrd">/&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Note that the theme (in bold) is rendered <strong>after</strong> core.css.</p>
<p>How did this happen?</p>
<p>You should already be familiar with SharePoint:CssLink and SharePoint:CssRegistration webcontrols via my previous articles. Behind the scenes to all of this, the theme is rendered via an additional control called the &lt;Sharepoint:Theme&gt; in the master page. Here is DEFAULT.MASTER source code that produced the above output</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Title</span> <span class="attr">ID</span>=<span class="attr">onetidTitle</span><span class="kwrd">&gt;&lt;</span><span class="html">asp:ContentPlaceHolder</span> <span class="attr">id</span>=<span class="attr">PlaceHolderPageTitle</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;&lt;/</span><span class="html">Title</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">SharePoint:CssLink</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">SharePoint:Theme</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>If you look carefully at the above source code, you will see that the only reason that the theme has overriding CORE.CSS is because the SharePoint:Theme control is listed <strong>after</strong> Sharepoint:CSS. If you reverse the order of the two controls, as expected the order of the theme is changed. In the example below, I took a copy of DEFAULT.MASTER and made the following modification:</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Title</span> <span class="attr">ID</span>=<span class="attr">onetidTitle</span><span class="kwrd">&gt;&lt;</span><span class="html">asp:ContentPlaceHolder</span> <span class="attr">id</span>=<span class="attr">PlaceHolderPageTitle</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;&lt;/</span><span class="html">Title</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">SharePoint:Theme</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">SharePoint:CssLink</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>and the resulting HTML is now reversed with CORE.CSS once again last.</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">id</span><span class="kwrd">=&quot;onetidThemeCSS&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/ft1/_themes/PimpSharePoint/Pimp1011-65001.css?rev=12%2E0%2E0%2E6007&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/controls.css?rev=EhwiQKSLiI%2F4dGDs6DyUdQ%3D%3D&quot;</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/HtmlEditorCustomStyles.css?rev=8SKxtNx33FmoDhbbfB27UA%3D%3D&quot;</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/HtmlEditorTableFormats.css?rev=guYGdUBUxQit03E2jhSdvA%3D%3D&quot;</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span> <span class="kwrd">/&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Thus, although you will read that themes are used to say, &quot;re-skin the layout of a site&quot;, in reality, it is the order of the application of CSS files that determine what parts of a site a theme will modify. Put in a different way, you add whatever you like to the theme CSS files and it will act like any other CSS, except it gets rendered last <strong>by default</strong>.</p>
<p><a href="http://www.heathersolomon.com/blog/archive/2007/05/13/Master-Pages-vs.-Themes-Which-Do-You-Choose.aspx">Heather</a> notes that themes have the same benefit as using &quot;Master Page Settings&quot; to override CORE.CSS. That is, they also apply to _layouts pages and affect APPLICATION.MASTER. The only reason that they work here is because the APPLICATION.MASTER master page used for _layout pages has the SharePoint: Theme webcontrol in its source code.</p>
<p>A gotcha with this method is that themes are <strong>per farm</strong>. Since they reside on the web front end server, my &quot;Pimp Sharepoint&quot; theme is available to any site in the farm. What&#8217;s more, if I modify the theme here, all sites are modified. This can be good but is equally going to catch you out as your SharePoint farm grows.</p>
<p>Another gotcha! Do not for a second assume that the SharePoint:Theme control is always included in master pages because it is not! Go and check the master pages that are installed by the &quot;Office SharePoint Server Publishing Infrastructure&quot; feature and you will see that none of them use the SharePoint:Theme webcontrol. Therefore, no matter what you put as your theme for sites based on publishing master pages, only the _layout pages (based on APPLICATION.MASTER) are affected by the theme CSS. (This to me reinforces my belief that themes are a legacy technology.)</p>
<p>Another gotcha! You will not like themes if you have a lot of sub-sites because you have to apply it at the site level for each site. Unlike the other methods described thus far, this method is not inheritable to sub-sites.</p>
<p>Yet another issue that makes this method a low cleverworkarounds rating, is that themes have to be installed on the web front end servers. In a large scale farm, there may be several WFE servers that need this set. There is no version control, version history, recycle bin, publishing approvals, and as a developer it means you have to deal with anal SharePoint infrastructure or governance Nazis who will not even talk to you unless you have packaged your work up as a solution.</p>
<p><strong><em>Cleverworkaround Rating: Sucky </em></strong></p>
<h2>Overriding CSS &#8211; Master Page Settings with @import</h2>
<p>This is a method that I considered but did not test, although I am sure that it will work (so I would be happy to hear from anyone who did). It actually needs to be used in combination with the &quot;<a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">master page settings</a>&quot; method that I described in article 2. The idea here is based around strict naming conventions for CSS files.</p>
<p>Now remember my original scenario, I have a master page, and a corporate brand CSS that needs to override CORE.CSS (CSS number #1). But then I have additional CSS files that override the corporate brand CSS file depending on the site. Using the master page settings to specify a CSS file only deals with CSS number 1.</p>
<p>But my idea here is that the CSS to be specified in Master Page Settings (CSS number 1) , refers to one of more additional CSS via the <a href="http://www.topxml.com/css/css_rule_import.asp">@import</a> directive. The names are strictly defined, so for example:</p>
<p>@import url(brandingoverridemintyfresh.css);</p>
<p>@import url(brandingoverrideorgchange.css);</p>
<p>So now, you have two extra CSS &#8216;placeholders&#8217;. If they do not exist in the site collection, they will not be used. But if you put a CSS file into the site collection, and give it one of the above names, you should in theory get the additional styles required.</p>
<p>This method seems relatively simple in the sense that it is all done in the CSS files, and the SharePoint GUI. However, since by default the CSS files reside in the site collection style library, adding or removing CSS files affect the entire site collection. This behavior can probably overridden with hard-coded or relative URL&#8217;s but it will not be great. Hard-coding anything is &quot;not clever&quot; for scalability and flexibility, and relative URL&#8217;s are difficult because site collections are not necessarily top level sites.</p>
<p>In addition, your CSS file can get ugly, with lots of @import references to files that do not exist which will confuse things later if governance around this is not well handled.</p>
<p>I won&#8217;t assign this a rating, given that I didn&#8217;t test it. But I can see it would have its uses in some circumstances. If someone wants to experiment with this I&#8217;m happy to link you, or add to this article.</p>
<h2>My solution</h2>
<p>Now despite the fact that I&#8217;ve in effect bagged themes earlier, the actual styles defined in the themes are some of the ones you are likely to be interested in, when performing a branding exercise. It is this fact that led me to my final solution that for me, had the best clever rating of all.</p>
<p>So let&#8217;s now examine our matrix so far with the addition of the themes method.</p>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Method</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Advantages</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Disadvantages</strong></td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">SharePoint:CSSRegistration</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not override core.css<br />
        <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Master Page Settings</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement<br />
        <br />- Overrides core.css</p>
<p>- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Can only be used once<br />
        <br />- Has to be set up for each site</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">&lt;link&gt; method</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Precludes &quot;Master Page Settings&quot; CSS override<br />
        <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Michael&#8217;s webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</p>
<p>- Works nicely with &quot;Master Page Settings&quot; CSS override</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages<br />
        <br />- core.css as the first CSS can be problematic</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">My webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</p>
<p>- Works nicely with &quot;Master Page Settings&quot; CSS override</p>
<p>- core.css is not the first stylesheet in the list</p>
<p>- allows choice as to what css overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Custom Themes</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement (GUI set)<br />
        <br />- Overrides core.css</p>
<p>- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Modifying the theme modifies all sites using it<br />
        <br />- Not inherited &#8211; has to be manually set for all sites</p>
<p>- Installing and updating themes require farm administrator and manual configuration of WFE servers</p>
<p>- Not all master pages will obey the theme</td>
</tr>
</tbody>
</table>
<h2></h2>
<h2>Over-riding CSS &#8211; The hybrid!</h2>
<p>Now remember my original scenario, I have a master page, and a corporate brand CSS that needs to override CORE.CSS (CSS number 1). But then I have additional CSS files (let&#8217;s collectively call them CSS number 2), that override the corporate brand CSS file depending on the site. CSS number 2 assumes that CSS number 1 is also referenced. This keeps CSS number 2 smaller and more manageable. But the disadvantage is that as discussed, using the master page settings to specify a CSS file can only be used once and therefore <strong>only deals with CSS number 1</strong>.</p>
<p>But&#8230;what if we took all of the bits that needed to be overridden CORE.CSS and moved them to CSS number 2? Then CSS number 1 is left with styles that CORE.CSS does not interfere with.</p>
<p>CSS number 2 (remember there are potentially many of these) is a little bigger now, as it has some additional styles since now it has to deal with any CORE.CSS interference, however it is still relatively maintainable.</p>
<p>So then, we can do this&#8230; (&#8230;drumroll)</p>
<p>Have the generic branding (CSS number 1) added to the master page using the SharePoint:CSSRegistration method. Then any CSS number 2, can be specified by the &#8216;master page settings&#8217; method.</p>
<p>So to illustrate, let&#8217;s take a look at the source code to our branded master page.</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">SharePoint:CssLink</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
 <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
 <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~sitecollection/Style Library/zMyDefaultBrand.css %&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">SharePoint:Theme</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>So, looking at this code, you can see that we are using SharePoint:CssRegistration, to specify a CSS file called <strong>zMyDefaultBrand.css</strong>. Remember why I prepended it with a z? It&#8217;s because SharePoint:CssLink control renders CSS files in alphabetical order it will be rendered <strong>last</strong> by the CSSLink webcontrol, except for CORE.CSS of course.</p>
<p>You can also see that I left the SharePoint:Theme control in so it can be used if required.</p>
<p>So, since we have moved all the CORE.CSS overrides to CSS number 2, we have a default CSS file called MyTheme.css. This now goes hand in hand with zMyDefaultBrand.css and is set set via the &quot;master page settings&quot; screen.</p>
<p>So the rendered HTML code combines to this:</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/en-US/Core%20Styles/Band.css&quot;</span> <span class="attr">mce_href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/en-US/Core%20Styles/Band.css&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/en-US/Core%20Styles/controls.css&quot;</span> <span class="attr">mce_href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/en-US/Core%20Styles/controls.css&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/zMyDefaultBrand.css&quot;</span> <span class="attr">mce_href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/zMyDefaultBrand.css&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/pc/_styles/core.css&quot;</span> <span class="attr">mce_href</span><span class="kwrd">=&quot;/sites/pc/_styles/core.css&quot;</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/MyTheme.css&quot;</span> <span class="attr">mce_href</span><span class="kwrd">=&quot;/sites/pc/Style%20Library/MyTheme.css&quot;</span><span class="kwrd">/&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Let&#8217;s look at the result and compare with our requirements. As you can see, CORE.CSS still beats zMyDefaultBrand.css but it is subsequently beaten by MyTheme.css, so we can override any CORE.CSS quirks.</p>
<p>Since MyTheme.CSS contains all of the look and feel styles that are usually defined in the SharePoint themes and CORE.CSS, the _layouts pages based on APPLICATION.MASTER get overridden nicely. By splitting the CSS we are able to define the global style in zMyDefault.css and the *default* CORE.CSS override in MyTheme.CSS</p>
<p>Since we are using master page override method, this is set on a per site basis and is inheritable from a parent site. Now our web designers can work their CSS magic to make additional MyTheme.css type files to offer flexible branding options such as MyThemeMintyFresh.CSS or MyThemeCorporateBrandB.CSS. Web administrators can pick the CSS file they want to use on a site by site basis giving complete flexibility.</p>
<p>Wohoo!</p>
<p><strong><em>Cleverworkaround rating: Nice </em></strong></p>
<h2>Summary</h2>
<p>So here is the final version of my table..</p>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Method</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Advantages</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Disadvantages</strong></td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">SharePoint:CSSRegistration</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not override core.css<br />
        <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Master Page Settings</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement<br />
        <br />- Overrides core.css</p>
<p>- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Can only be used once<br />
        <br />- Has to be set up for each site</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">&lt;link&gt; method</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Precludes &quot;Master Page Settings&quot; CSS override<br />
        <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Michael&#8217;s webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</p>
<p>- Works nicely with &quot;Master Page Settings&quot; CSS override</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages<br />
        <br />- core.css as the first CSS can be problematic</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">My webcontrol</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Set in master page once<br />
        <br />- Overrides core.css</p>
<p>- Works nicely with &quot;Master Page Settings&quot; CSS override</p>
<p>- core.css is not the first stylesheet in the list</p>
<p>- allows choice as to what css overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">Custom Themes</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement (GUI set)<br />
        <br />- Overrides core.css</p>
<p>- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Modifying the theme modifies all sites using it<br />
        <br />- Not inherited &#8211; has to be manually set for all sites</p>
<p>- Installing and updating themes require farm administrator and manual configuration of WFE servers</p>
<p>- Not all master pages will obey the theme</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">My Hybrid Method</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- Easy to implement (GUI set)<br />
        <br />- Overrides core.css</p>
<p>- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="top">- master page setting is always specified</td>
</tr>
</tbody>
</table>
<h2></h2>
<h2>Next steps</h2>
<p>I am a two finger typist, so after 3 articles you would think we are done. But nooooo, we still haven&#8217;t solved all of the issues. <a href="http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/">Next stop</a>, we examine how to deploy this to the farm set-up in a nice, easy to maintain format. So we do some work on features, solutions, quirks (yeah there are quirks) and governance around it all.</p>
<p><!--adsense--></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding &#8211; How CSS works with master pages &#8211; Part 2</title>
		<link>http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 19:33:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[SharePoint Branding]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/</guid>
		<description><![CDATA[Jeez if I had realised how long it would take to write these damn articles, I probably wouldn&#8217;t have started! In my first article of this topic, I discussed the theory behind master pages, the publishing feature, and what I think is the main issue with SharePoint branding &#8211; APPLICATION.MASTER and CORE.CSS. In this article [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p><!--adsense--></p>
<p>Jeez if I had realised how long it would take to write these damn articles, I probably wouldn&#8217;t have started! In <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">my first article</a> of this topic, I discussed the theory behind master pages, the publishing feature, and what I think is the main issue with SharePoint branding &#8211; APPLICATION.MASTER and CORE.CSS. In this article I will now list a branding scenario that I had to deal with, and the various options you can use to deal with the challenges of APPLICATION.MASTER <strong>and</strong> CORE.CSS</p>
<h2>The Scenario</h2>
<p>Like many organizations, my client had an existing corporate branding standard that was used in a non SharePoint environment and naturally enough, they wanted their SharePoint site to look like this branding.</p>
<p>This was for a fully featured intranet/extranet that utilized most of the MOSS2007 features such as</p>
<ul>
<li>Document collaboration </li>
<li>Infopath Forms Services </li>
<li>Workflow </li>
<li>Enterprise Search </li>
<li>Excel services </li>
<li>Business Data Catalog </li>
<li>Custom web parts </li>
<li>Event Handlers </li>
</ul>
<p>It was *not* a public site at all.</p>
<p>Initial investigation soon concluded that we would need a custom master page. DEFAULT.MASTER didn&#8217;t quite have the design flexibility that was required. In fact the branding requirements were actually closer to some of the built in master pages such as BLUEGLASS.MASTER, since this was for intranet purposes, particularly collaborative document management, those master pages are unsuitable. (I will explain why soon).</p>
<p><span id="more-153"></span></p>
<table cellspacing="0" cellpadding="2" width="100%" border="0">
<tbody>
<tr>
<td valign="top" width="124"><iframe style="width: 120px; height: 240px" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=cleverwo-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0735625336&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" scrolling="no"></iframe></td>
<td valign="top" width="890">
<p>Other major requirements included mandatory consistency of branding across the entire farm. This meant that we had to deal with the <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">APPLICATION.MASTER issue</a> as described in my last post. Additionally, different semi-autonomous divisions within the client&#8217;s organisation wanted to be able to modify the corporate brand in accordance with existing branding policy (mainly colours/skinning) while maintaining the existing structural look and feel.</p>
<p>Additionally, as well as the corporate branding, there was another, very different branding which was used as part of a communications plan for some organizational change stuff. This had a deliberately different look to the rest of the site, yet the web designer had been clever when this design was created. They were able to completely rebrand the look and feel of the additional branding just through additional CSS and not wholesale HTML structural changes.</p>
<p>So, really, we had two general classes of sites. &#8216;Standard&#8217; corporate sites and the custom branded &#8216;Organisational Change&#8217; site.</p>
<p>&#160;</p>
</td>
</tr>
</tbody>
</table>
<p>The type of MOSS environment this was to be applied to was a medium to large SharePoint farm with three web front end (WFE) servers, and there were several SharePoint web applications and site collections in the farm that needed this branding. Further down the track, there was to be other SharePoint farms in different offices around the world with localized language requirements.</p>
<p>The final requirement (the one that complicated things) was that many of the CORE.CSS styles needed to be overridden to ensure the branding was correct.</p>
<h2>The Custom Master Page</h2>
<p>The first decision to make is whether to stick to just CSS modifications to an existing master page, or to create a new master page. This post is based around a new master page, however the CSS methods I outline in this post are equally valid when using, say, DEFAULT.MASTER or one of the publishing master pages like BLUEBAND.MASTER.</p>
<p>So since we knew we had to use a custom master page, we had 3 choices in creating a new master page.</p>
<ul>
<li>Make a copy of DEFAULT.MASTER and use that </li>
<li>Start with a completely blank master page </li>
<li>Make a copy of one of the publishing master pages like BLACKBAND.MASTER </li>
</ul>
<p>I&#8217;ll actually deal with the third option first because we initially used it and then discounted it.</p>
<p>As previously mentioned, in our case BLUEGLASS.MASTER was the closest of the built in master pages to our branding needs but in the end we did not use it. Publishing master pages are actually somewhat simpler than the default.master page. Some web controls/placeholders have been modified/removed from publishing master pages, and if you use them for say, a document collaboration site, you will find quirks like:</p>
<ul>
<li>Missing breadcrumb navigation in document libraries when browsing subfolders </li>
<li>Missing recycle bin link </li>
<li>Different navigational structure </li>
<li>Tree-view not being rendered despite being selected </li>
<li>Themes are ignored (I discuss this in detail in <a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">part 3</a>) </li>
</ul>
<p>Furthermore, I actually read not so long ago that it was recommended that these pages be generally used for internet facing sites which by definition tend to be publishing sites. (I&#8217;m trying to find the reference and as soon as I locate it I&#8217;ll paste here), but <a href="http://www.tylerbutler.com/work/Pages/BuildingMOSSMasterPages.aspx">Tyler&#8217;s post</a> offers some hints where he talks of custom CSS and navigation out of the box.</p>
<p>A blank master page is potentially a great option, either the <a href="http://msdn2.microsoft.com/en-us/library/aa660698.aspx">MSDN</a> one that everyone seems to hate or <a href="http://www.heathersolomon.com/blog/archive/2007/01/26/6153.aspx">Heather&#8217;s</a>, that the general population seems to like. Ultimately flexibility, of course, as it means that you can code up the look and feel from scratch. Unless you are a world class web designer and have a great understanding of ASP.NET, it may not be worth the time and budget (especially for an internal facing site).</p>
<p>So, we chose to simply make a copy of default.master because we actually did not have to change that much to achieve our ends. Yes it is complex and fiddly, but it is the out of the box master page that works with SharePoint, so using it as a base is a pretty safe bet. The main issue you need to watch out for when doing this, is related to the <a href="http://www.cleverworkarounds.com/2007/10/15/careful-with-pre-requisite-sharepoint-features/" target="_blank">publishing feature</a>.</p>
<p>So, for the purposes of this article, our new master page will be referred to as PIMPMYSHAREPOINT.MASTER &#8211; and we have to get our custom CSS styles into this.</p>
<p><iframe style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none" border="0" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=cleverwo-20&amp;o=1&amp;p=48&amp;l=st1&amp;mode=books&amp;search=sharepoint%20training&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" width="99%" scrolling="no" height="90"></iframe></p>
<h2>Over-riding CSS &#8211; SharePoint:CSSRegistration</h2>
<p>We <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">took a look</a> at SharePoint:CssRegistration and its brother SharePoint:CssLink in <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/">part 1</a>, but I think it&#8217;s worth a recap.</p>
<p>SharePoint:CssRegistration defines a CSS file and Sharepoint:CssLink is the control that actually renders the SharePoint:CssRegistration styles as well as CORE.CSS.</p>
<p><span style="font-family: courier new">&lt;head runat=&quot;server&quot;&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;Sharepoint:CssLink runat=&quot;server&quot; /      <br /></span><span style="font-family: courier new">&lt;!&#8211;Styles used for positioning, font and spacing definitions&#8211;&gt;      <br /></span><span style="font-family: courier new">&lt;SharePoint:CssRegistration name=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/pimpmysharepoint.css%&gt;&quot; runat=&quot;server&quot;/&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;/head&gt;      <br /></span></p>
<p>And the result is&#8230;</p>
<p><font face="Courier New">&lt;head&gt;      <br />[snip]       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot;/&gt;       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot; mce_href=&quot;/_layouts/1033/styles/core.css&quot;/&gt;       <br />[snip]       <br />&lt;/head&gt; </font></p>
<p>As discussed in part 1, CORE.CSS, has been rendered, despite the fact that it is not explicitly defined. What&#8217;s more, CORE.CSS is always listed last.</p>
<p>Ah! But remember our requirement above? Our custom styles need to override styles in CORE.CSS! GONG! This isn&#8217;t going to do it for us.</p>
<p><strong><em>Cleverworkaround Rating: Useless for me </em></strong></p>
<h2>Over-riding CSS &#8211; Master Page Settings</h2>
<p>So we look at the next most obvious way to defeat this CORE.CSS issue. On a MOSS07 site with the &quot;Office SharePoint Server Publishing Infrastructure&quot; site collection feature enabled, we have the means to add a custom CSS to a master page via the GUI. It can be found in Site Settings on any site. Navigate to look and feel and choose &quot;Master Page&quot;.</p>
<p><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/101107-0533-sharepointb11.png" /></p>
<p>Scroll to the bottom of this page and you will see the CSS override settings.</p>
<p><img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/101107-0533-sharepointb21.png" /></p>
<p>From here, you can choose a custom CSS file to use. In this example we have chosen pimpmysharepoint.css which was uploaded to the style library for this site collection. Let&#8217;s examine the HTML output once pimpmysharepoint.css has been selected.</p>
<p><span style="font-family: courier new">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_styles/core.css&quot; mce_href=&quot;/_styles/core.css&quot;/&gt;      <br /></span><span style="font-family: courier new">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/PimpMySharePoint.css&quot; mce_href=&quot;/Style%20Library/PimpMySharePoint.css&quot;/&gt;</span></p>
<p>Aha! We have overridden CORE.CSS &#8211; nice! Given that we have not modified the master page itself, we can conclude that SharePoint:CssLink will render the &quot;alternate CSS URL&quot; last. In addition, we have solved the APPLICATION.MASTER problem. Hands up who can tell me why ? <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  The reason is that APPLICATION.MASTER uses SharePoint:CssLink as well, so it will render this CSS in _layout pages derived from that master page.</p>
<p>Furthermore, we did it with no coding or custom work, and it can be inherited or forced out to all subsites from this one. WOHOO!</p>
<p>So? Have we found our clever workaround? No we have NOT. DOH! We have a workaround, but I do not believe that it&#8217;s clever yet!</p>
<p>Remember my requirements. We had a corporate brand that required CORE.CSS override for a few styles. In addition, we have the &#8216;organizational change&#8217; branding CSS that overrides the corporate branding CSS. In addition, even within corporate branding we had CSS overrides for individual departments too.</p>
<p>So what is our problem then?</p>
<p>Using this method, we can only override once! Once you set this alternate CSS, that&#8217;s it. Thus, if I was to use this method, I would have to maintain several large custom CSS files, one for each branding scenario. Given that 80% of the actual styles are consistent between them, I prefer a method where the common stuff is kept common, rather than risk being fragmented over time with changes to one of the CSS files not being propagated to others.</p>
<p>I&#8217;m sure many of you would be okay with this, and for certain clients, I would be too. However, call me anal if you want but I wanted to find a better way.</p>
<p><strong><em>CleverWorkaround Rating: Close, but no cigar! </em></strong><strong><em>       <br /></em></strong></p>
<h2>Over-Riding CSS &#8211; Static CSS Link</h2>
<p>Now, given that SharePoint:CssLink control renders stylesheet links at runtime, what is stopping us simply adding a static CSS link in the master page? The source code below illustrates the idea.</p>
<p><span style="font-family: courier new">&lt;head runat=&quot;server&quot;&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;Sharepoint:CssLink runat=&quot;server&quot; /      <br /></span><span style="font-family: courier new">&lt;!&#8211;Styles used for positioning, font and spacing definitions&#8211;&gt;      <br /></span><span style="font-family: courier new">&lt;SharePoint:CssRegistration name=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/pimpmysharepoint.css%&gt;&quot; runat=&quot;server&quot;/&gt;      <br /></span><span style="font-family: courier new"><strong>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style Library/anothercss.css&quot;/&gt;        <br /></strong></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;/head&gt; </span></p>
<p>This works on the premise that 80% of your branding (the stuff that CORE.CSS doesn&#8217;t screw with) is in PIMPMYSHAREPOINT.CSS. The other 20% that needs to override CORE.CSS is in ANOTHERCSS.CSS.</p>
<p>So, now I have embedded a static link into the master page. Before we go on to assess its cleverness, can you see my mistake?</p>
<p>Imagine, that you have 3 site collections named:</p>
<ul>
<li><a href="http://mysite/">http://mysite</a> </li>
<li><a href="http://mysite/sites/collection1">http://mysite/sites/collection1</a> </li>
<li><a href="http://mysite/sites/collection2">http://mysite/sites/collection2</a> </li>
</ul>
<p>That static link, will always try and use the style library for the top site collection, even for the bottom two site collections. But what if the users do not have permission to the top site collection? Will the CSS render? Probably not as access to it would be denied.</p>
<p>Here is the adjusted source to fix this &#8211; using a token to render the correct site collection URL.</p>
<p><span style="font-family: courier new">&lt;head runat=&quot;server&quot;&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;Sharepoint:CssLink runat=&quot;server&quot; /      <br /></span><span style="font-family: courier new">&lt;!&#8211;Styles used for positioning, font and spacing definitions&#8211;&gt;      <br /></span><span style="font-family: courier new">&lt;SharePoint:CssRegistration name=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/pimpmysharepoint.css%&gt;&quot; runat=&quot;server&quot;/&gt;      <br /></span><span style="font-family: courier new"><strong>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/anothercss.css%&quot;/&gt;        <br /></strong></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;/head&gt;      <br /></span>&gt;</p>
<p>See what I have done (in bold)? I have placed the rendered link into the master page source. I have used the $SPURL:~SiteCollection token though which at runtime gets replaced with the path to the site collection. (In the example below the site collection was called &quot;/sites/nopub&quot;).</p>
<p>So let&#8217;s examine the HTML output of this.</p>
<p><font face="Courier New">&lt;head&gt;      <br />[snip]       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot;/&gt;       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot; mce_href=&quot;/_layouts/1033/styles/core.css&quot;/&gt;       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot;/&gt;       <br />[snip]       <br />&lt;/head&gt;</font></p>
<p>Wohoo! We have our custom styles after CORE.CSS. What&#8217;s more, we can add as many &lt;link&gt; entries as we like here. Although not shown above, I could have one &lt;link&gt; with the 80% of common styles and another &lt;link&gt; with the 20% of custom ones.</p>
<p>So have we found our branding utopia? No &#8211; hell no!</p>
<p>One of the disadvantages with this method is that if your &lt;link&gt; is placed AFTER SharePoint:CssLink, then it will also trump your &quot;alternate CSS URL&quot; setting described in the &quot;master page setting&quot; method. This is because the alternate CSS URL is rendered by SharePoint:CssLink. Placing your static link before SharePoint:CssLink is utterly pointless, because <strong>all</strong> of the CSS files specified by SharePoint:CssRegistration will trump the &lt;link&gt; entry. The whole point here was to override CORE.CSS.</p>
<p>If that wasn&#8217;t bad enough, the clincher is that _layout pages, based on APPLICATION.MASTER master page, will not have this static link anyway. Therefore, your branding is inconsistent for _layout pages and in fact is likely WORSE because it will apply the 20% customizations of ANOTHERCSS.CSS but the other 80% of PIMPMYSHAREPOINT.CSS common styles will be missing.</p>
<p><strong><em>CleverWorkaround Rating: Pretty damn crappy actually !        <br /></em></strong></p>
<p>So, what can we try next?</p>
<h2>Over-riding CSS &#8211; Mike&#8217;s method</h2>
<p>Now <a href="http://www.sharepointblogs.com/michael/archive/2007/07/16/sharepoint-s-core-css-stylesheet-put-it-to-where-it-belongs.aspx">this method</a> I was very, very impressed with (and cursed that I did not think of it myself). Mike came up with a novel way to solve the CORE.CSS problem. He created his own asp.net control that REPLACES SharePoint:CssLink. He has inherited the CSSLink class and modified the rendered output to move CORE.CSS from last to first. Ingenious!</p>
<p>So, to implement this, you need to compile it to a DLL in visual studio. You need to copy the DLL into the global assemble cache, and then mark the web control as safe. This is done by making a modification to the &lt;safecontrols&gt; section of the XML file, WEB.CONFIG of the web application that is going to render this control.</p>
<p><span style="font-family: courier new">&lt;SafeControls&gt;      <br /></span></p>
<p><span style="font-family: courier new">[snip]      <br /></span></p>
<p><span style="font-family: courier new">&lt;SafeControl Assembly=&quot; MichaelHofer.SharePoint.PublishingEnhancements, Version=1.1.0.0, Culture=neutral, PublicKeyToken=7ce575c89ea427a4&quot; Namespace=&quot; MichaelHofer.SharePoint.PublishingEnhancements &quot; Safe=&quot;True&quot; /&gt;      <br /></span></p>
<p><span style="font-family: courier new">&lt;/SafeControls&gt; </span></p>
<p>Then, in the custom master page, you have to tell SharePoint how to find the DLL. It is called &#8216;declaring the assembly&#8217;. Here is Mike&#8217;s example:</p>
<p><span style="font-family: courier new">&lt;%@ Register Tagprefix=&quot;PublishingEnhancements&quot; Namespace=&quot;MichaelHofer.SharePoint.PublishingEnhancements&quot; Assembly=&quot;MichaelHofer.SharePoint.PublishingEnhancements, Version=1.1.0.0, Culture=neutral, PublicKeyToken=7ce575c89ea427a4&quot; %&gt;      <br /></span></p>
<p>And now, you delete the reference to &lt;SharePoint:CssLink&gt; in the master page and use Mike&#8217;s control.</p>
<p><span style="font-family: courier new">&lt;PublishingEnhancements:EnhancedCssLink runat=&quot;server&quot;/&gt;      <br /></span></p>
<p>Now, let&#8217;s examine the output when using this method.</p>
<p><font face="Courier New">&lt;head&gt;      <br />[snip]       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot; mce_href=&quot;/_layouts/1033/styles/core.css&quot; /&gt;       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; /&gt;       <br />&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot; /&gt;       <br />[snip]       <br />&lt;/head&gt; </font></p>
<p>So, CORE.CSS is now moved to the top and the world is a happy place! Or is it?</p>
<p>I had one problem with this method. Moving CORE.CSS unexpectedly changed the look of my branding. Then I realized the problem. Now CORE.CSS was being overwritten by every other style, and this was causing unforeseen side effects.</p>
<p>One other DOH problem. APPLICATION.MASTER will not reflect this change &#8211; so it has the same issue as the &lt;link&gt; method.</p>
<p>Despite this, I am going to give Mike a high cleverworkaround rating for this solution, but I am going to have to take off one point because he did not package it up into a solution <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Mike will probably think this is terribly unfair, but on my SharePoint large farms with multiple WFE servers, if it is not a solution, it doesn&#8217;t go into production! (That&#8217;s the topic of part 4 of this series of articles).</p>
<p><strong><em>CleverWorkaround Rating: Flawed genius &#8211; respect, man !</em></strong></p>
<h2>Over-riding CSS Files &#8211; My method</h2>
<p>Inspired by Mike&#8217;s cleverness, I came up with an idea to improve his control. I dusted off VS2005 and added a public property called DefaultCSS. This holds the value of a CSS file I am interested in.</p>
<p><span style="font-family: courier new">private string CSS;      <br /></span><span style="font-family: courier new">public virtual string DefaultCSS      <br /></span><span style="font-family: courier new">{      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; get      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; return CSS;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; set      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; CSS = value;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">}      <br /></span></p>
<p>Next I changed the render method, to swap the value stored in this property with CORE.CSS</p>
<p><span style="font-family: courier new">protected override void Render(System.Web.UI.HtmlTextWriter output)      <br /></span><span style="font-family: courier new">{      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; // Let base render the stylesheets      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; StringWriter sw = new StringWriter();      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; base.Render(new HtmlTextWriter(sw));      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; string renderedOutput = sw.ToString();      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; if (this.CSS == null) {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.Write(renderedOutput);      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; else      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Split the styleSheets into an array      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; string[] styleSheets = renderedOutput.Split(new char[] { &#8216;\n&#8217; }, StringSplitOptions.RemoveEmptyEntries);      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (styleSheets.Length == 0) {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.Write(renderedOutput);      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; else      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Find reference of core and CSS property      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int CSSRef = new int();      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int CoreRef = new int();      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &lt; styleSheets.Length; i++) {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (styleSheets[i].Contains(this.CSS)) {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CSSRef = i;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else if (styleSheets[i].Contains(&quot;core.css&quot;)) {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CoreRef = i;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else {      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; styleSheets[i] = styleSheets[i] + &quot;\n&quot;;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Now swap those elements      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string tmp = styleSheets[CSSRef];      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; styleSheets[CSSRef] = styleSheets[CoreRef] + &quot;\n&quot;;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; styleSheets[CoreRef] = tmp + &quot;\n&quot;;      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.Write(string.Concat(styleSheets));}}      <br /></span><span style="font-family: courier new">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">&#160;&#160;&#160; }      <br /></span><span style="font-family: courier new">}      <br /></span></p>
<p>So, as with Mike&#8217;s control, I compiled it to a DLL and copied it into global assemble cache (GAC), and then marked the web control as safe in web.config.</p>
<p>Then, in the master page, I added a reference to my DLL.</p>
<p><span style="font-family: courier new">&lt;%@ Register Tagprefix=&quot;PublishingEnhancements&quot; Namespace=&quot;cleverworkarounds.SharePoint.PublishingEnhancements&quot; Assembly=&quot; cleverworkarounds.SharePoint.PublishingEnhancements, Version=1.1.0.0, Culture=neutral, PublicKeyToken=7ce575c89ea427a4&quot; %&gt; </span></p>
<p>And now, you delete the reference to &lt;SharePoint:CssLink&gt; in the master page and use my version of the control. (Don&#8217;t forget to add the DefaultCSS property!).</p>
<p><span style="font-family: courier new">&lt;PublishingEnhancements:EnhancedCssLink runat=&quot;server&quot; DefaultCSS=&quot;anothercss.css&quot; /&gt; </span></p>
<p>I then packaged this up as part of my branding feature/solution (more on this in part 4) and then deployed with success. Now let&#8217;s examine the output when using this method.</p>
<p><span style="font-family: courier new">&lt;head&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot; /&gt;      <br /></span><span style="font-family: courier new">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/_layouts/1033/styles/core.css&quot; mce_href=&quot;/_layouts/1033/styles/core.css&quot; /&gt;      <br /></span><span style="font-family: courier new">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot; mce_href=&quot;/sites/nopub/Style%20Library/anothercss.css&quot; /&gt;      <br /></span><span style="font-family: courier new">[snip]      <br /></span><span style="font-family: courier new">&lt;/head&gt; </span></p>
<p>So now, only ANOTHERCSS.CSS has been swapped with CORE.CSS. PIMPMYSHAREPOINT.CSS is rendered prior to both, but the key here is CORE.CSS is not rendered last!</p>
<p>So, was I a genius? Was this the clever workaround? Can I give myself a high clever rating? <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Unfortunately not. Both Mike&#8217;s method and my BRO (blatant rip off) of his method fail to deal with the _layouts/APPLICATION.MASTER issue. In addition, this method requires the most customization. We need to add a DLL to the GAC, declare it in the master page, as well as tell the various SharePoint web applications that the control is safe to use.</p>
<p>If you do all this manually on a single server WFE farm, you can probably get away with this, but on a medium to large scale farm, it should be packaged up as a solution before being deployed.</p>
<p><strong><em>CleverWorkaround Rating: Was a worthwhile exercise </em></strong></p>
<p>So &#8230; let&#8217;s take a breath and recap on the 5 methods discussed so far and list their relative merits and disadvantages.</p>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Method</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Advantages</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Disadvantages</strong></td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">
<p><strong>SharePoint:CSSRegistration</strong></p>
</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">
<p>- Easy to implement</p>
</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">
<p>- Does not overrides core.css            <br />- Does not work with _layout pages</p>
</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Master Page Settings</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Easy to implement          <br />- Overrides core.css           <br />- Works on _layout pages</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Can only be used once          <br />- Has to be set up for each site</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>&lt;link&gt; method</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Set in master page once          <br />- Overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Precludes &quot;Master Page Settings&quot; CSS override          <br />- Does not work with _layout pages</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>Michael&#8217;s webcontrol</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Set in master page once          <br />- Overrides core.css           <br />- Works nicely with &quot;Master Page Settings&quot; CSS override</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Does not work with _layout pages          <br />- core.css as the first CSS can be problematic</td>
</tr>
<tr>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle"><strong>My webcontrol</strong></td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Set in master page once          <br />- Overrides core.css           <br />- Works nicely with &quot;Master Page Settings&quot; CSS override           <br />- core.css is not the first stylesheet in the list           <br />- allows choice as to what css overrides core.css</td>
<td style="padding-right: 2px; padding-left: 2px; padding-bottom: 2px; padding-top: 2px" valign="middle">- Does not work with _layout pages</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>Now for many SharePoint logical architectures, these methods will likely work very well (Okay&#8230; maybe not the &lt;link&gt; method). I hope that some people will find that one of these options solves their respective issues. Unfortunately in my situation each had enough drawbacks that I kept looking.</p>
<p>So, in <a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">part 3</a> of this series of articles, I will explain some more options, and explain the method that eventually worked the best for me.</p>
<p><iframe style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none" border="0" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=cleverwo-20&amp;o=1&amp;p=15&amp;l=st1&amp;mode=books&amp;search=sharepoint%20designer&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" width="668" scrolling="no" height="240"></iframe></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>SharePoint Branding &#8211; How CSS works with master pages &#8211; Part 1</title>
		<link>http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 05:04:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[master pages]]></category>
		<category><![CDATA[page layouts]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/</guid>
		<description><![CDATA[This is version 2 of this article, after I went and accidentally blew away my first masterpiece that took literally days to write. If this has ever happened to you, don&#8217;t you hate it, that your second version is never as good as your first? Quick Links: [Part 1, Part 2, Part 3, Part 4, [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p>This is version 2 of this article, after I went and accidentally blew away my first masterpiece that took literally days to write. If this has ever happened to you, don&#8217;t you hate it, that your second version is never as good as your first?</p>
<p>Quick Links: [Part 1, <a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">Part 2</a>, <a href="http://www.cleverworkarounds.com/2007/10/13/sharepoint-branding-%e2%80%93-how-css-works-with-master-pages-%e2%80%93-part-3/">Part 3</a>, <a href="http://www.cleverworkarounds.com/2007/10/25/sharepoint-branding-part-4-packaging-up-your-masterpiece-into-a-feature/">Part 4</a>, <a href="http://www.cleverworkarounds.com/2007/10/27/sharepoint-branding-part-5-%e2%80%93-feature-improvements-and-bugs/">Part 5</a>, <a href="http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/">Part 6</a>, <a href="http://www.cleverworkarounds.com/2007/11/14/sharepoint-branding-the-governance-of-it-all-part-7/">Part 7</a>]</p>
<table cellspacing="0" cellpadding="2" width="99%" border="0">
<tbody>
<tr>
<td valign="top" width="137"><iframe style="width: 120px; height: 240px" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=cleverwo-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0470096012&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" scrolling="no"></iframe></td>
<td valign="top" width="616">
<p>Anyway, this is (attempt 2 of) part 1 of a series of articles that cover SharePoint branding in some detail. Kudos has to be given <a href="http://www.heathersolomon.com/">Heather Solomon</a> especially for her wonderful site and articles on this subject (and author of the book to your left <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . In Addition, <a href="http://www.andrewconnell.com/blog/">Andrew Connell</a> and <a href="http://www.sharepointblogs.com/michael/archive/2007/07/16/sharepoint-s-core-css-stylesheet-put-it-to-where-it-belongs.aspx">Mike</a> have done some great work that helped me in this area.</p>
<p>So, SharePoint branding was the catalyst behind my deciding to make a blog and call it cleverworkarounds. The whole experience at times made me want to change careers, but I ultimately got there. I would go down one path, only to be stumped by a problem, and think I have the solution, only to find another quirk that needed another workaround. So the aim of cleverworkarounds is to determine the <em>least</em> dodgy way to implement branding of a SharePoint installation. No doubt people will disagree with the conclusions I&#8217;ve reached, but that&#8217;s expected since the cleverness of a workaround really depends on your needs.</p>
<p>&#160;</p>
</td>
</tr>
</tbody>
</table>
<p>So this series of articles will cover a few issues. First some basic master page theory, then I will talk about the difference between branding in WSS3 (the freebie version) and MOSS07 (the pricey one). I will then take you through the quirks of CSS and master pages. Subsequent articles will get into the details of branding techniques and finally finish off by covering the governance issues surrounding branding.</p>
<p><span id="more-32"></span></p>
<h2>Master Page theory    <br /></h2>
<p>This is a large topic in itself, but I will try and cover it quickly. Heather has written the <a href="http://www.heathersolomon.com/blog/articles/MOSS07DesignComponents.aspx">definitive explanation</a> for master pages so I&#8217;m trying here to cover the bits I want to cover without rehashing her great work. Suffice to say that the technology is actually part of ASP.NET and SharePoint simply leverages this (no point reinventing the wheel after all). Generally, most aspx pages in a SharePoint site will be derived from a Page Layout (content) page that itself, refers to a master page. Below is the MSDN diagram illustrating the concept.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb1.gif" /></p>
<p>MSDN has a good definition: &quot;A master page contains references to elements that you can share across multiple pages in an Office SharePoint Server 2007 site, such as navigation, search controls, logon controls, and banner images. A master page can also contain the cascading style sheet (CSS) and ECMAScript (JScript, JavaScript) references that define the overall look and feel of your site. Commonly, every site&#8212;and therefore every page&#8212;in your site collection uses the same master page to present a consistent user experience across the entire site collection. Depending on your needs, you can use a different master page for one or for all of the sites in your site hierarchy to distinguish the various areas of your portal.&quot;</p>
<p>To illustrate this idea, below I have pasted the very top line in a resulting page &quot;DEFAULT.ASPX&quot; from a basic SharePoint site.</p>
</p>
<pre class="csharpcode" style="width: 656px; height: 96px">&lt;%@ Page language=<span class="str">&quot;C#&quot;</span> MasterPageFile=<span class="str">&quot;~masterurl/default.master&quot;</span>
Inherits=<span class="str">&quot;Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,
Culture=neutral,PublicKeyToken=71e9bce111e9429c&quot;</span> meta:webpartpageexpansion=<span class="str">&quot;full&quot;</span>
meta:progid=<span class="str">&quot;SharePoint.WebPartPage.Document&quot;</span> %&gt; </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Note the reference to the token <strong>~masterurl/default.master</strong> in the first line. This is a special token that represents the currently used master page. (I will drill down further on this in a few moments).</p>
<p>A master page, like DEFAULT.MASTER, will almost always refer to one or more CSS files to style the site. Below I have pasted some of the HTML browser output from the very same DEFAULT.ASPX that I referred to above.</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?
rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span><span class="kwrd">/&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>So in the example above, any ASPX page that uses DEFAULT.MASTER, refers to a CSS file called CORE.CSS.</p>
<p>Thus, SharePoint branding usually means either:</p>
<ul>
<li>Using the default master page and simply overriding the built in CSS styles with your own </li>
<li>Creating a new master page and then overriding the built in CSS styles with your own.<br />
    </li>
</ul>
<p>So let&#8217;s drill down a little further, by looking at another master page and compare it with DEFAULT.MASTER. MOSS does come with some other master pages we can examine, but depending on your site template, you may have to activate the publishing <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-%e2%80%9cfeatures%e2%80%9d-in-plain-english/">feature</a>. If you wondering what a feature is, check <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-%e2%80%9cfeatures%e2%80%9d-in-plain-english/">this post</a>, and then come back <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>So let&#8217;s activate the publishing feature and see what happens.</p>
<p><iframe style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none" border="0" marginwidth="0" marginheight="0" src="http://rcm.amazon.com/e/cm?t=cleverwo-20&amp;o=1&amp;p=48&amp;l=st1&amp;mode=books&amp;search=sharepoint&amp;fc1=000000&amp;lt1=&amp;lc1=3366FF&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" width="99%" scrolling="no" height="90"></iframe></p>
<h2>WSS, MOSS and the Publishing Feature </h2>
<p>This article is primarily written around MOSS07 and not WSS3, but WSS3 is worth a quick discussion. WSS can be branded using the techniques I outline here, but if you are being paid to brand a SharePoint site/farm, it is very likely you are using MOSS.</p>
<p>The reason for this, is that WSS3 does not have available a site collection feature called &quot;Office SharePoint Server Publishing Infrastructure&quot;. It is this feature that gives you all the tools you need to manage branding easily from just the web browser, as well as provide some sample master pages and different styles to learn from.</p>
<p>Almost all branding articles I have read assume this feature is installed and activated, but it is not always active for a site collection, depending on the site template used to create the site collection. You will find it under &quot;Site Collection Features&quot; in the &quot;Site Actions&quot; -&gt; &quot;Site Settings&quot; screen.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb2.png" /></p>
<p>So if you cannot find this feature listed, you are probably using WSS3. Sorry, but you are going to have a more fiddly time because you have to change your master page using SharePoint Designer (Kathy has written a nice overview <a href="http://mindsharpblogs.com/kathy/archive/2007/02/19/1577.aspx">here</a>). But to get a quick sense of the idea, re-examine the reference to the master page token below..</p>
</p>
<pre class="csharpcode">&lt;%@ Page language=<span class="str">&quot;C#&quot;</span> MasterPageFile=<span class="str">&quot;~masterurl/default.master&quot;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>In WSS, this refers to what SharePoint designer calls the &quot;Default master page&quot;. Below, I show where I have taken a copy of DEFAULT.MASTER and called it PIMPMYSHAREPOINT.MASTER and set it as the default master page. Note that when I right click on PIMPMYSHAREPOINT.MASTER I have an option to set this as the default master page.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb3.png" /></p>
<p>So now, when SharePoint loads pages on this site, the token &quot;~masterurl/default.master&quot; is replaced at run time by the default master page set above &#8211; &quot;pimpmysharepoint.master&quot;.</p>
<p>Of course, if you have MOSS2007 and enable the publishing feature, you have a much easier method to change the master page for a site that does not involve SharePoint designer. So let&#8217;s enable this site collection feature and see what happens.</p>
<p>First up, (note below what a site collection looks like <strong>without</strong> this publishing infrastructure feature activated), you have a master page gallery link, but under &quot;look and feel&quot;, there are no options related to choosing any other master pages.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb4.png" /></p>
<p>If you open the site up in SharePoint designer, you will also see a basic SharePoint structure. Below shows a SharePoint site collection created using the blank SharePoint site template.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb5.png" /></p>
<p>So now let&#8217;s activate the site collection feature &quot;Office SharePoint Server Publishing Infrastructure&quot; and re-examine the above site. Note the change in options, particularly in relation to &quot;Look and Feel&quot;. We now have a link for choosing which master page to use. That saves you having to fiddle with SharePoint Designer, doesn&#8217;t it?&#160; <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb6.png" /></p>
<p>It is when you look at the site collection in SharePoint Designer though, that you see the significant changes which have been made. There are a lot more goodies there now in the form of Lists, Document Libraries and Workflows. Thus, the publishing feature does a lot more than simply add a link to choose a master page. <a href="http://www.mindsharpblogs.com/Penny/archive/2007/09/28/2973.aspx" target="_blank">Penny</a> has a great, detailed description of the additional resources installed by enabling this feature</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb7.png" /></p>
<p>So, now let&#8217;s choose a different master page. Under &quot;Master Page Settings&quot; in the &quot;Look and Feel&quot; section of site administration, you will see a selection of example master pages that come with the feature.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb8.png" /></p>
<p>Now, at this point, I will throw you a little theory. With WSS, I explained how you can use SharePoint designer to change the master page to set the default master page. But MOSS gives you the nice method of being able to do this via the administration pages for a site collection. Both methods look in the same place &#8211; The master page gallery.</p>
<p>When you provision a site collection the system creates a master page gallery that contains all the master pages and page layouts for that site collection. The master page gallery is stored at the location /_catalogs/masterpages. It is a standard document library and as a result has version history, recycle bin support, approval workflow and all of the other document management goodies you get with SharePoint. This is great, since it makes it easy to roll back if an update to a master page file goes horribly wrong. No matter how many sub sites you make in the site collection, they will all be able to access the master page library via the link to /_catalogs/masterpages.</p>
<p>Below is the content of the master page gallery when the publishing feature has been enabled.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb9.png" /></p>
<p>So, too easy then. Any web designer should be able to crank out their design app of choice, drop it into the master page gallery and shoot out a master page in minutes right? &#8230; Riiiiggghht? <img src='http://www.cleverworkarounds.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Well&#8230;yes, they can, but there are two major issues that cause a lot of grief with branding, CORE.CSS and APPLICATION.MASTER. The next section describes this.</p>
<h2>CORE.CSS </h2>
<p>So a quick recap. When you create a SharePoint site collection, even if using the blank site template, a document library is created to store master pages. It is referred by the path of _catalogs/masterpage and is called the &quot;master page gallery&quot;. The actual master page used, is a site based property set either via Sharepoint Designer (WSS3) or site administration (MOSS07). The master page almost always defaults to DEFAULT.MASTER (although site templates can actually specify another). DEFAULT.MASTER refers to a file called CORE.CSS. Thus, any web pages that use this template will always use CORE.CSS when processing styles.</p>
<p>Recap over: Now lets dig a bit more into CSS files in SharePoint!</p>
<p>The best way to understand how CSS is handled actually is to look at one of the sample master pages, for example blackglass.master that comes with the publishing feature. Since it significantly changes the look and feel of a site when applied, we know that CSS modifications have been made. If you go to the master page gallery of your publishing enabled site (http://&lt;mysiteurl&gt;/catalogs/masterpage), you will be able to download this master page and check out the source code in notepad or any other HTML designer. I have pasted the important bit below:</p>
</p>
<pre class="csharpcode" style="width: 656px; height: 197px"><span class="kwrd">&lt;</span><span class="html">head</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">&gt;</span> 
[snip] 
    <span class="kwrd">&lt;</span><span class="html">Sharepoint:CssLink</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span> <span class="kwrd">/&gt;</span> 
    <span class="rem">&lt;!--Styles used for positioning, font and spacing definitions--&gt;</span> 
    <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span> 
    <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span> 
    <span class="kwrd">&lt;</span><span class="html">SharePoint:CssRegistration</span> <span class="attr">name</span><span class="kwrd">=&quot;&lt;% $SPUrl:~SiteCollection/Style Library/zz1_black.css%&gt;&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">/&gt;</span> 
[snip] 
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Allow me to introduce you to two webcontrols. SharePoint:CssLink and SharePoint:CssRegistration</p>
<h3>SharePoint:CssLink and SharePoint:CssRegistration </h3>
<p>SharePoint:CssRegistration defines a CSS file &#8211; simple as that. If you look closely at the example however, you will notice that like the reference to a master page, there are tokens here that the system replaces at runtime. Let&#8217;s examine one further, looking at the source code and then what is rendered in the browser for an example site:</p>
</p>
<pre class="csharpcode" style="width: 656px; height: 25px">&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Rendered as:</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/en-US/Core%20Styles/Band.css&quot;</span><span class="kwrd">&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>Sharepoint:CssLink is the control that actually renders the styles. So, for every style defined by a SharePoint:CssRegistration, SharePoint:CssLink will process all of the runtime tokens like ~language and render the CSS files. Let&#8217;s now look at the input again for blackband.master and the output</p>
</p>
<pre class="csharpcode">&lt;head runat=<span class="str">&quot;server&quot;</span>&gt; 
[snip] 
&lt;Sharepoint:CssLink runat=<span class="str">&quot;server&quot;</span> / 
&lt;!--Styles used <span class="kwrd">for</span> positioning, font and spacing definitions--&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/zz1_black.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
[snip] 
&lt;/head&gt; </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>And the result is&#8230;</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span> 
[snip] 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/en-US/Core%20Styles/Band.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/en-US/Core%20Styles/controls.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/zz1_black.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span><span class="kwrd">/&gt;</span> 
[snip] 
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>What do you notice here? There were only 3 registered CSS files in the master page. However, 4 CSS files were rendered to the browser. CORE.CSS, you will notice, has been rendered, despite the fact that it is not explicitly defined. What&#8217;s more, (and this is the important bit), CORE.CSS is <strong>always listed last</strong>.</p>
<p>This behaviour is not always a problem, but in many circumstances it can be. Imagine that you have your own overridden styles for example, pimpmysharepoint.master, refers to a style called pimpmysharepoint.css. The source code would look like this.</p>
</p>
<pre class="csharpcode">&lt;Sharepoint:CssLink runat=<span class="str">&quot;server&quot;</span> / 
&lt;!--Styles used <span class="kwrd">for</span> positioning, font and spacing definitions--&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/pimpmysharepoint.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>And the output is..</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span> 
[snip] 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/pimpmysharepoint.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span><span class="kwrd">/&gt;</span> 
[snip] 
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>So CORE.CSS (which is a rather large file with a LOT of styles in it), will override my custom styles.</p>
<p>Here is another quirk with SharePoint:CssRegistration. Not only does it render CORE.CSS last, but it renders the other styles in alphabetical order. So even if I changed the order of the SharePoint:CssRegistration entries in the source, they will always render in alphabetical order. (I assume this is why Microsoft chose to name a style as zz1_black.css to ensure it rendered second last).</p>
<p>For example, with the CssRegistration order changed in the source..</p>
</p>
<pre class="csharpcode">&lt;head runat=<span class="str">&quot;server&quot;</span>&gt; 
[snip] 
&lt;Sharepoint:CssLink runat=<span class="str">&quot;server&quot;</span> / 
&lt;!--Styles used <span class="kwrd">for</span> positioning, font and spacing definitions--&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/zz1_black.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~sitecollection/Style Library/~language/Core Styles/controls.css %&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
&lt;SharePoint:CssRegistration name=<span class="str">&quot;&lt;% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/Band.css%&gt;&quot;</span> runat=<span class="str">&quot;server&quot;</span>/&gt; 
[snip] 
&lt;/head&gt;</pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>And the result is still rendered the same way..</p>
</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span> 
[snip] 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/en-US/Core%20Styles/Band.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/en-US/Core%20Styles/controls.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/sites/nopub/Style%20Library/zz1_black.css&quot;</span><span class="kwrd">/&gt;</span> 
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="attr">href</span><span class="kwrd">=&quot;/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D&quot;</span><span class="kwrd">/&gt;</span> 
[snip] 
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span> </pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, "Courier New", courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt <br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }<br /></style>
</p>
<p>So, the gist of the issue here, is that you do not always necessarily want CORE.CSS to be rendered last.</p>
<p>The last thing to say here, is to credit Heather Solomon for actually sitting down and producing a CSS <a href="http://www.heathersolomon.com/content/sp07cssreference.htm">reference chart</a> for CORE.CSS, so you can easily see just how much of the look and feel of SharePoint it controls. Often you will want to override some of the styles in CORE.CSS, but clearly, the SharePoint:CssLink webcontrol will not allow you to.</p>
<h2>APPLICATION.MASTER </h2>
<p>So far, we have talked about DEFAULT.MASTER, as well as the master pages that are installed by the &quot;Office SharePoint Server Publishing Infrastructure&quot; feature. They all reside in the document library called the master page gallery at /_catalogs/masterpage.</p>
<p>But guess what? There is <strong>another</strong> master page used in SharePoint sites and this one does not live in the master page gallery. Some of the pages use another master page called APPLICATION.MASTER. All affected pages are references by the _layout entry in the URL. Some of the more visible components of a SharePoint site that are affected includes:</p>
<ul>
<li>View all site content<br />
    </li>
<li>Version History or a document or list<br />
    </li>
<li>Workflow settings of a document library<br />
    </li>
<li>Recycle Bin<br />
    </li>
<li>Search results </li>
</ul>
<p>You will notice that if you try all of the above options, you will be referred to a URL that has a path of _layouts.</p>
<p>_layouts is a directory that is common to all sites and site collections of a SharePoint web application. This is because _layouts is an IIS virtual directory that points to a location on the server.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb10.png" /></p>
<p>The physical location on the server that _layouts refers to is generally C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb11.png" /></p>
<p>Now you may have realized the issue with APPLICATION.MASTER. It will not have a reference to any custom CSS files. Let&#8217;s check the source code of APPLICATION.MASTER</p>
<p><span style="font-family: courier new">&lt;HEAD runat=&quot;server&quot;&gt;<br />
    <br />[snip] </p>
<p>&#160;&#160;&#160; &lt;SharePoint:CssLink runat=&quot;server&quot;/&gt; </p>
<p>[snip] </p>
<p>&lt;/HEAD&gt; </span></p>
<p>So, based on what we have learned about SharePoint:CssLink, we know that APPLICATION.MASTER is only ever going to render CORE.CSS. Therefore, any custom CSS files used in custom master pages will never be referenced for _layout pages that use APPLICATION.MASTER. This can easily be demonstrated. Below is a blank site collection with the publishing feature enabled. I have changed the master page to blackband.master in &quot;Site Actions&quot; -&gt; &quot;Site Settings&quot;.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb12.png" /></p>
<p>But now when we click on the &quot;documents&quot; link, which is basically &quot;view all site content&quot; you will see we no longer have the blankband branding. Instead it looks like the default branding again.</p>
<p><img alt="" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0504-sharepointb13.png" /></p>
<p>You will also notice above, the telltale &quot;_layout&quot; reference in the URL which tells you that this page has been rendered from APPLICATION.MASTER.</p>
<p>So these two issues alone can be an annoyance, when you combine them, it can really be a pain in the butt. In <a href="http://www.cleverworkarounds.com/2007/10/11/sharepoint-branding-how-css-works-with-master-pages-part-2/">Part 2</a> of this set of articles, we will examine the branding scenario that started me on this journey, and then examine various approaches to SharePoint branding, to work around these two issues.</p>
<p>Thanks for reading!</p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/08/sharepoint-branding-how-css-works-with-master-pages-part-1/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>A simple example of a SharePoint &#8220;feature&#8221;</title>
		<link>http://www.cleverworkarounds.com/2007/10/08/a-simple-example-of-a-sharepoint-%e2%80%9cfeature%e2%80%9d/</link>
		<comments>http://www.cleverworkarounds.com/2007/10/08/a-simple-example-of-a-sharepoint-%e2%80%9cfeature%e2%80%9d/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 05:00:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/10/08/a-simple-example-of-a-sharepoint-%e2%80%9cfeature%e2%80%9d/</guid>
		<description><![CDATA[If you check my introductory post, I discussed the concept of SharePoint features in a real world scenario. In this post I actually show an example of features from end to end, to illustrate that scenario. So, first to recap the scenario, slightly simplified from my other post: A webdesigner has a new CSS file [...]<p class="tags">No Tags</p>]]></description>
			<content:encoded><![CDATA[<p><!--adsense-->   <br />If you check my <a href="http://www.cleverworkarounds.com/2007/10/08/sharepoint-%e2%80%9cfeatures%e2%80%9d-in-plain-english/">introductory post</a>, I discussed the concept of SharePoint features in a real world scenario. In this post I actually show an example of features from end to end, to illustrate that scenario.</p>
<p>So, first to recap the scenario, slightly simplified from my other post: A webdesigner has a new CSS file that is the new corporate branding standard. They must package it up as a &#8216;feature&#8217;. A misunderstood sysadmin nazi installs the feature onto the SharePoint farm once only, then sends a mail to the 35 site collection owners advising them to activate the &quot;branding feature&quot; on their sites.&#xA0; Each site collection owner who does so has the identical configuration modified so it is all nice and consistent.</p>
<p>Now also before we start, this demo requires the &quot;Office SharePoint Server Publishing Infrastructure&quot; feature to be enabled. If this is not enabled, the &quot;Style Library&quot; document library that we rely on, will not exist.</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=10"><img height="84" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam1.jpg" width="611" border="0" /></a></p>
<p><strong></strong></p>
<p><strong>Step 1: Create the Feature</strong></p>
<p>Our web designer of course has a development box so they can&#8217;t kill production. On this box they navigate to the</p>
<p><span style="font-family: courier new">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES </span></p>
<p>and create a new folder called CustomBranding</p>
<p><span style="font-family: courier new">C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\CustomBranding </span></p>
<p>Inside this folder we place our CSS file (in this case, called CustomBrand.CSS) and we create a file called FEATURE.XML.</p>
<p>Now in real life, you will copy a FEATURE.XML from one of the many other features here and work off that. But in our case, we will just type it in. The contents of FEATURE.XML is this:</p>
<p><font face="Courier New">&lt;Feature Id=&quot;01c34560-6561-11dc-8314-0800200c9a66&#x2033;&#xA0;&#xA0;&#xA0; <br />Title=&quot;Pimp my SharePoint&quot;&#xA0;&#xA0;&#xA0; <br />Description=&quot;This is a feature that adds a new sexy CSS&quot;&#xA0;&#xA0;&#xA0; <br />Version=&quot;1.0.0.0&#x2033;&#xA0;&#xA0;&#xA0; <br />Scope=&quot;Site&quot;&#xA0;&#xA0;&#xA0; <br />xmlns=&quot;</font><a href="http://schemas.microsoft.com/sharepoint/""><font face="Courier New">http://schemas.microsoft.com/sharepoint/&quot;</font></a><font face="Courier New">&gt;&#xA0;&#xA0;&#xA0; <br />&lt;ElementManifests&gt;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <br />&#xA0;&#xA0;&#xA0; &lt;ElementManifest Location=&quot;ProvisionedFiles.xml&quot;/&gt;&#xA0;&#xA0;&#xA0; <br />&lt;/ElementManifests&gt;       <br />&lt;/Feature&gt;</font></p>
<p>So we have a &lt;feature&gt; element and inside that an &lt;elementmanifests&gt; element. The required parameters for the &lt;feature&gt; element are below (lifted straight from <a href="http://msdn2.microsoft.com/en-us/library/ms436075.aspx" target="_blank">MSDN</a>)</p>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Attribute</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Description</strong></td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Description</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Optional String</strong>. Returns a longer representation of what the Feature does.</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Id</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Required Text</strong>. Contains the globally unique identifier (GUID) for the Feature.</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Scope</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Required Text</strong>. Can contain one of the following values: Farm (farm), WebApplication (Web application), Site (site collection), Web (Web site).</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Title</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Optional Text</strong>. Returns the title of the Feature. Limited to 255 characters.</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" colspan="2"><strong>Version</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Optional Text</strong>. Specifies a System.Version-compliant representation of the version of a Feature. This can be up to four numbers delimited by decimals that represent a version.</td>
</tr>
</tbody>
</table>
<p>So the first thing to do is generate a GUID. You can do this a number of ways, but I typically use an online generator like the one <a href="http://www.famkruithof.net/uuid/uuidgen">here</a> to do it.</p>
<p>My GUID from the online generator is:&#xA0; <em>01c34560-6561-11dc-8314-0800200c9a66</em>. Feel free to use it for this example but you should substitute with your own.</p>
<p>Title and description parameters should be plainly obvious and version is optional, but whack it in anyway.</p>
<p>Scope is important, a feature can be activated at various points in the farm. &quot;Site&quot; means it is activated once per site collection. All sub-sites under this site collection can make use of the feature without having to activate it. This will become clear later.</p>
<p>Next we refer to an &lt;element manifest&gt;. This is a reference to another XML file that actually tells Sharepoint what to do (provisionedfiles.xml). In our case, it is going to tell SharePoint to upload the CustomBrand.CSS file to the site collection style library.</p>
<p>Let&#8217;s take a look.</p>
<p><font face="Courier New">&lt;Elements xmlns=&quot;</font><a href="http://schemas.microsoft.com/sharepoint/""><font face="Courier New">http://schemas.microsoft.com/sharepoint/&quot;</font></a><font face="Courier New">&gt;      <br />&#xA0;&#xA0;&#xA0; &lt;Module Name=&quot;MyPimpedStyles&quot; Url=&quot;Style Library&quot; RootWebOnly=&quot;TRUE&quot;&gt;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <br />&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; &lt;File Url=&quot;CustomBrand.css&quot; Type=&quot;GhostableInLibrary&quot; /&gt;&#xA0;&#xA0;&#xA0;&#xA0; <br />&#xA0;&#xA0;&#xA0; &lt;/Module&gt;       <br />&lt;/Elements&gt; </font></p>
<p>In this file, the top-level Elements element defines the elements comprising the Feature. In my previous post, I outlined a table of elements that can be used to install SharePoint features.</p>
<ul>
<li>Content Types: Contains a definition of a SharePoint content type. </li>
<li>Content Type Binding: Actually applies a content type to a document library. </li>
<li>Control: Allows you to replace existing controls on the page, such as the search or navigation with your own custom control. </li>
<li>Custom Action: You can define custom actions such as add a new menu item in &quot;Site Actions&quot;. </li>
<li>Feature/Site Template Association: This allows you to bind a feature to a site template so that the feature is included in new sites based on that template. </li>
<li>Field: Contains a field, or column definition that can be reused in multiple lists. </li>
<li>Hide Custom Action: Opposite to &quot;Custom Action&quot;, where you want to hide menu items. </li>
<li>List Instance: Provisions a SharePoint site with a list which includes specific data. </li>
<li>List Template: A list definition or template, which defines a list that can be provisioned to a SharePoint site. </li>
<li>Module: Deploys files which are included when provisioning sites. </li>
<li>Receiver: Defines an event handler for a list, or document library </li>
<li>Workflow: Defines a workflow for a list, or document library.&#xA0; </li>
</ul>
<p>So as you can see in the above XML file, we have used the MODULE element to install 1 single file. Let&#8217;s examine the &lt;MODULE&gt; and &lt;FILE&gt; element in detail.</p>
<p><font face="Courier New">&lt;Module Name=&quot;MyPimpedStyles&quot; Url=&quot;Style Library&quot; RootWebOnly=&quot;TRUE&quot;&gt;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; <br />&lt;File Url=&quot;CustomBrand.css&quot; Type=&quot;GhostableInLibrary&quot; /&gt;&#xA0;&#xA0;&#xA0;&#xA0; <br />&lt;/Module&gt; </font></p>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="138"><strong>Module Attribute</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="868"><strong>Description</strong></td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="138"><strong>Name</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="868">Required Text. Contains the name of the file set. </td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="138"><strong>RootWebOnly</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="868">Optional Boolean. TRUE if the files specified in the module are installed only in the top-level Web site of the site collection.</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="138"><strong>Url</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle" width="868">Optional Text. Specifies the virtual path of the folder in which to place the files when a site is instantiated. If Path is not specified, the value of Url is used for the physical path. Use the Url attribute to provision a folder through the Feature.</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse" border="0">
<tbody>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>File</strong>           <br /><strong>Attribute</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Description</strong></td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>IgnoreIfAlreadyExists</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle">Optional Boolean. TRUE to provision the view even if the file aready exists at the specified URL; otherwise, FALSE.</td>
</tr>
<tr>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle"><strong>Type</strong></td>
<td style="padding-right: 1px; padding-left: 1px; padding-bottom: 1px; padding-top: 1px" valign="middle">Optional Text. Specifies that the file be cached in memory on the front-end Web server. Possible values include Ghostable and GhostableInLibrary. Both values specify that the file be cached, but GhostableInLibrary specifies that the file be cached as part of a list whose base type is Document Library.When changes are made, for example, to the home page through the UI, only the differences from the original page definition are stored in the database, while default.aspx is cached in memory along with the schema files. The HTML page that is displayed in the browser is constructed through the combined definition resulting from the original definition cached in memory and from changes stored in the database.</td>
</tr>
</tbody>
</table>
<p>So, the module section is specifying where any &lt;file&gt; elements be copied to. We are going to copy this to the document library called &quot;Style Library&quot; in the root web site for the site collection.&#xA0; </p>
<p>&#xA0;</p>
<p><strong>Step 2. Installing and testing the Feature</strong> </p>
<p>Now that our web developer has created the feature, they test it on their development SharePoint server. Open command prompt and execute the STSADM -installfeature command. When the -name parameter is specified, SharePoint knows to look in the TEMPLTE\FEATUIRES folder already, so you do not have to specify a full path.</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=6"><img height="257" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam2.jpg" width="460" border="0" /></a></p>
<p><strong>Step 3. Test the feature </strong></p>
<p>Okay, so the feature is installed. Now what? Now we need to activate this feature on a site collection. Here is the &quot;Style Library&quot; of my test site. (Remember that this library will not exist unless the SharePoint Publishing Infrastructure feature has been installed). Note that at this time, there is no CSS file called CUSTOMBRAND.CSS</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=7"><img height="296" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam3.jpg" width="575" border="0" /></a></p>
<p>So now let&#8217;s Activate the feature. Browse to Site Actions&gt;Site Settings and from the Site Collection Administration menu, choose &quot;Site Collection Features&quot;. Lo and behold! We have our feature listed! Note the title and description is as per our FEATURE.XML file.</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=8"><img height="96" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam4.jpg" width="540" border="0" /></a></p>
<p>Click &quot;Activate&quot; to activate the feature (you can also do this on the command line via STSADM -o activatefeature command). Once it is marked as active, re-examine the style library. Woo freakin hoo! There is our CSS file!</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=9"><img height="386" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam5.jpg" width="599" border="0" /></a></p>
<p><strong>Step 5. Test and deploy the Feature </strong></p>
<p>In our example here, we can test this feature, by choosing to use this new CSS file in the master page settings of any site within the site collection. The Site Collection administrator navigates to site settings-&gt;look and feel-&gt;master page settings and specifies the CSS file override as shown below.</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=12"><img height="195" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam6.jpg" width="438" border="0" /></a></p>
<p>By clicking on the &quot;Browse&quot; button, they can select the CSS file from the style library in the site collection.</p>
<p><a href="http://www.cleverworkarounds.com/?attachment_id=11"><img height="501" src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam7.jpg" width="632" border="0" /></a></p>
<p>This highlights the relationship between the web designer and the farm, site collection and site owners. In a large production farm the sequence would look something like this.</p>
<ul>
<li>The developer creates and tests the feature </li>
<li>The developer hands the tested and approved feature to the the SharePoint farm administrator </li>
<li>The SharePoint farm administrator copies this feature into the FEATURES folder on the web front end servers on the farm and notifies the site collection administrators that the feature has been installed </li>
<li>Each site collection administrator activates the feature and informs the site owners that the feature is now available. </li>
<li>Each site owner optinally chooses to use this new CSS installed by the feature. </li>
</ul>
<p><strong></strong></p>
<p><strong>Summing Up</strong> </p>
<p>I hope that you found this article useful. Now you are going to totally hate me, because now I am going to tell you that features are only half of the solution to SharePoint customisation. &quot;What is the other half&quot;? you may ask.&#xA0; Well the other half of the solution is &quot;solutions&quot; &#x2026; don&#8217;t you just love generic terminology! <img src="http://www.cleverworkarounds.com/wp-content/uploads/2007/10/100807-0459-asimpleexam8.gif" /> </p>
<p>&#xA0;</p>
<p>&#xA0;</p>
<p></p>
<p> <!--adsense--></p>
<p class="tags">No Tags</p>]]></content:encoded>
			<wfw:commentRss>http://www.cleverworkarounds.com/2007/10/08/a-simple-example-of-a-sharepoint-%e2%80%9cfeature%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
