Q: Is there an easier way to get started in building my add-in other than building it from scratch... like a project template?
A: There are no official project templates and to fill this gap back in April (now) WHS MVP Ken Warren did release a couple example templates that I've used for every single add-in and test add-in I've written.
Unfortunately as useful as his templates are, they have a number of issues that require some extra work to make work property, so I built a couple of new and improved ones:
Looking for another language? Managed C++? J#? Feel free to ask.
Installation Instructions
Copy to language template of your choice to the following directory on your Vista development machine:
%UserProfile%\Documents\Visual Studio 2005\Templates\ProjectTemplates\<Language>\
or under XP/2003:
%UserProfile%\My Documents\Visual Studio 2005\Templates\ProjectTemplates\<Language>\
Where <Language> is either Visual C# or Visual Basic.
Usage
Launch Visual Studio 2005**, bring up the New Project dialog and select the language of your choice. Under the My Templates section you will see a template named Home Server Add-In (apologies for the poor icons*), select it, type in a name for your project and press the OK button.
The created project will contain 2 different kinds of files, user controls and the required Home Server classes.
Two classes named HomeServerTabExtender and HomeServerSettingsExtender do the work of informing the Home Server Console what controls exist in your add-in, what their display name should be and other settings. With the exception of changing the display text and icon, you can largely leave these classes alone.
There are also two user controls named MainTabUserControl and SettingsTabUserControl which are the place for you to add your custom layout and code with the ease of the Visual Studio Forms Designer.
There are just two things that you'll need to do before your new add-in will be useable on your Home Server...
Add Reference
Unless you've specially rigged your development environment (which I'll cover in a later Dev Tip), you'll need to manually add a reference to HomeServerExt.dll (located in C:\Program Files\Windows Home Server\ on your Home Server).
Visual Studio Bug
For your add-in to be detected by the Home Server Console, the deployed assembly must have a name and namespace that match the following pattern:
Assembly Name:
HomeServerConsoleTab.YourTabName
Namespace:
Microsoft.HomeServer.HomeServerConsoleTab.YourTabName
Where YourTabName is the unique name you've given to your tab.
In order to make your tab meet these requirements, you will need to edit your project's properties and change the assembly name to meet the above criteria.
As easy as it is to make an add-in with these templates, a bug exists in Visual Studio 2005 and 2008 which allows the dynamic naming of the namespace based on the project name you specify... however the assembly name is always set to the project name, something that isn't always desired.
Deployment
To use your new add-in, simply copy it to the C:\Program Files\Windows Home Server\ directory on your Home Server and re-start the Home Server Console.
You can also make your own installer using WiX or Visual Studio Setup Project to install your add-in through the Home Server Console.
*If any readers have any suggestions as to how these templates could be improved, or want to make a better looking icon for the templates, please let me know.
**These templates have also been tested with the the beta 2 version of Visual Studio 2008 and to make them visible, change the directories mentioned previously appropriately (2005 -> 2008).
Note: The information in this post is based on undocumented and at times deduced information on Windows Home Server and is not officially supported or endorsed by Microsoft and could very easily be wrong or subject to change in future, so please take it and everything else said on this blog with a grain of salt and use with caution.