Sandcastle Vs 2010 styles: How can I change the default language tab?

Jun 15, 2012 at 8:08 AM

Hi all,

I'm new to Sandcastle. Now I'm creating a document that for my .NET Assemblies. After Sandcastle build the Help file, VB is the default language will be selected, but I want to select C# instead.

How can I change the default language tab to C#?

I'm using the latest Sandcastle builder (2.6) with SHFB 1.9.4, vs2010 styles.

Thanks all.

Jun 15, 2012 at 7:49 PM

I think that requires a modification to the XSL transformations for the VS2010 style.  See this post for details:



Jun 16, 2012 at 5:01 AM

Hi Eric,

I've read that discussion before. But I also want to change C# to default language tab, not only reorder the language tab.

Btw, I'll check these xml file again when I back to work.

Sorry because of my terrible English.

Jun 18, 2012 at 8:46 AM

I've check all xml file in content folder but I don't find anything seem can change the default language. Hope anyone help me.

Sep 21, 2012 at 7:20 PM

Hi Eric,

I have the same problem - I can change the tab order - but this just results in "the second tab is selected" - or in other words - still VB is default an not (as intended) C#



Sep 24, 2012 at 1:28 AM

I'll ask Don to see if he knows as he developed the presentation style.  I haven't examined it too closely yet so I don't know the answer.



Oct 2, 2012 at 2:59 PM

I have looked into this a bit and found the following in branding.js - onload():

var lang = GetCookie("CodeSnippetContainerLang", "Visual Basic");

The default is "Visual Basic" - I have search everywhere to see who sets "CodeSnippetContainerLang" and cannot find it (in SHFB and Sandcastle).

So, assuming it is not being set, the default will always be VB if the VB tab exists.

Questions - Where does branding.js come from? How can we override this?


Oct 2, 2012 at 3:26 PM

In the current release, Branding.js is coming from the dev10.mshc file which is part of the Visual Studio 2010 content installed for Help Viewer.  That makes it inaccessible for changes in the current release as the Help Viewer output will always load it from the default branding package.  Due to the number of changes I had to make to get the presentation styles working with Help Viewer 2, that is no longer the case in the next release and the script will be part of the normal presentation style and will be easy to modify should the need arise.  I'm hoping to get the next release out within a week or so.

Using the default branding package seemed like a good idea but it has proved to be otherwise so I'm getting rid of that method in favor of purely self-branded content like the other presentation styles.  There are some remnants of the branding stuff in the next release but only as far as the XSL transformations.  The images and scripts are available for modification as part of the general presentation style.  A future release will probably get rid of the remaining branding transformations too in favor of merging the processing into the other presentation style transformations.



Oct 2, 2012 at 7:55 PM

Awesome.  Thanks, as always, for the quick reply.


Oct 2, 2012 at 8:22 PM

I confirmed my theory about the default tab.

1) The "CodeSnippetContainerLang" cookie is not being set

2) The default of "Visual Basic" is being used

3) If you unzip dev10.mshc, edit branding.js, and set the following on line 13:

var lang = GetCookie("CodeSnippetContainerLang", "C#");

4) Save the ZIP and rebuild your help file

Then C# will be the default-selected tab on code examples.

Like you don't have enough to do, Eric...but can we implement the "CodeSnippetContainerLang" cookie so people don't have to edit a JS file for this feature?

There is similar thread in

Let me know which one we should be using.

FYI and thanks!


Oct 3, 2012 at 7:29 PM

Keeping the discussion here is fine since it is Sandcastle presentation style related.  I've changed the default tab order and made C# the default tab since it's first and this matches MSDN's behavior.  With regard to changing the preferences, the files are accessible in the next release and changing the order requires a change to the transformation so if you also want to change the default, a minor change to the script shouldn't be too hard to handle.  I'm going to go out on a limb and say that most people either won't care or will want to match the MSDN behavior so trying to add options to allow such customization via the build is probably more effort than it's worth.



Oct 3, 2012 at 7:33 PM

Fair enough....and thank you!

It is important to us because we have mostly C# developers but some VB (that is why I provide VB examples).

However, C# being first/default is really convenient.

Looking forward to the next release.

Thanks, Eric.

Oct 4, 2012 at 2:05 AM

Thank you for an awesome release, Eric