in

CodePrairie .NET

South Dakota .NET User Group

I Hate Linux

  • WHS Developer Tip #7: Testing without deployment

    Q: Is there any way to more rapidly test my add-in than copying it over to my WHS and restarting the console every single time I want to view a minor change?

    A: There are a few different ways (some of which I'll be covering in later tips) to test your add-in without manually copying it over to the server.

    UserControl Test Container

    If you are doing your development in VB.NET (2005 or 2008), are using UserControls (such as from the add-in template), and hit the F5 key to debug your work... then you've likely seen the UserControl TestContainer which is a simple application that lets you quickly test out a user control on a form.

    It works great... but is limited, especially considering it's not automatically wired up for C# projects, something that is tricky to do with C# Express.

    Stand-alone application

    Another quick and easy option that works equally well with any language is to add a new Windows Forms project to your solution that your add-in.

    This method enabled you to add your user controls to a form or two that you control and test them out in a similar manor to what the UserControl Test Container gives you.

    This too works great... but there is a better way.

    WHS Test Loader

    My preference has been for a tool I created called WHS Test Loader tool (previously discussed) which uses similar rules (from what I can discern) to the Home Server Console for loading an add-in and displays both it and the settings to the screen.

    While it doesn't give you everything that the real console does, it at least lets you test your add-in a bit on your own PC in more ways than just visually.

    Overview

    In addition to providing a couple of tabs which hold the actual main and settings tab controls, those tabs can also be accessed by clicking on one of the GroupBoxes which give a very loose idea of what your tab's buttons will look like in the Console.

    If you are planning on using some form of localization in your add-in, one of the most useful features to you will be the CurrentUICulture ListBox which lets you change the culture of the application's UI thread. Using this, you can easily test your add-in in English, German, Croatian or any other language or culture you want, it's just up to you to define the languages that you'll support.

    The Additional Tools tab is intended to be a home for other general troubleshooting and testing bits... for now it simply displays the contents of the CommonImages class.

    Another specialized feature offered by the Test Loader is a custom class that implements the IConsoleServices interface, an instance of which is passed into the constructor of your tab objects enabling you to still be able to call OpenSettings() and OpenUrl() without additional changes to your code to check if it is running in a test environment.

    Usage

    Start by downloading a copy of this tool to the same directory where you keep the files from your Home Server (due to all of the assemblies that it references).

    Once there you can either launch it manually and use the Load Assembly button to select your assembly... or have Visual Studio launch it for you.

    In order to configure Visual Studio...

    1. Open your project in your non-Express version Visual Studio (Express specific instructions can be found in the last section)

    2. Right click on your project in Solution Explorer and select Properties

    3. Select the Debug tab

    4. Change the start action to 'Start external program' and set the specified path to the location of WhsTestLoader.exe

    5. Set the 'Command line arguments' option to the name of your assembly (available under the Application tab) with the trailing .dll

    When all said and done you should end up with something that looks like this:

    Configured Debug Tab

    Once properly setup, when you next hit F5 (or what ever other method you use to start debugging) the Test Loader will launch with your tab inside, giving you a quick and easy method to test out some of the functionality of your add-in.

    For curious readers, the C# source code for this application is available.

    Sorry VB lovers, this app is C# only... but that doesn't mean you can't use the pre-built version to load and test add-ins written in the .NET language of your choice.

    Administrator

    A number of the controls and other less than documented features of the Home Server code that we can use requires elevated (administrative) permission... something that we as good programmers shouldn't be running as by default.

    That being said, unfortunately in order to fully test an add-in it is often necessary to run the Test Loader as Administrator, the easiest way to achieve is simply to run your instance of Visual Studio as Administrator (when running Vista) so that each time you attempt to debug, you are not greeted with a UAC prompt.

    Express Editions

    The Express Editions of Visual Studio (both 2005 and 2008) are purposely limited so as to encourage you to eventually by the higher (and pricey) versions of Visual Studio... the little secret is that most of those limitations are implemented in the user interface... which means that will a little knowledge of how the back-end files works, you can take advantage of a few less than well known features.

    One of the wonderful things about the Express Editions is that they use the exact same project and solution file format as the higher versions, enabling you to easily move code back and forth when needed.

    Another advantage of this is that the Express Editions will act on settings in a project file, even if it is incapable of setting it and such is the case with setting the Start Action.

    In order to make your project in Express launch the Test Loader, you'll need to break out your favorite text editor (ie notepad) and create a new file with these contents:

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>E:\WHS Dev\WHS - Server\WhsTestLoader.exe</StartProgram>
    <StartWorkingDirectory>
    </StartWorkingDirectory>
    <StartArguments>HomeServerConsoleTab.Home_Server_Add_In1.dll</StartArguments>
    </PropertyGroup>
    </Project>

    You will likely have to change the StartProgram tag to specify the path to where you put WhsTestLoader.exe, as well as StartArguments to reflect your assembly name.

    Next, save this file in the same directory as your project's project file (.csproj or .vbproj) and name it depending on your language:

    ProjectFileName.vbproj.user

    or

    ProjectFileName.csproj.user

    where ProjectFileName is the name of your project file.

    Because the text editor you are using probably doesn't default to using the .user extension, you'll need to wrap the entire filename in double quotes to force it to use that name, instead of letting it append it's own default extension to the end.

    Please note that the file name must be exact, so if your project's name is "Home Server Add-In1.vbproj", then your new file must be named "Home Server Add-In1.vbproj.user".

    Once you've created this file, load your project up in Express and hit F5 to begin debugging to launch the Test Loader with your add-in in it much like the folks with the expensive versions of Visual Studio.

    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.

  • Missing Certificate with WebFolders4WHS

    Problem:

    A user remotely connecting to a Windows Home Server computer configured with WebFolders4WHS may receive the following error:

    The folder you entered does not appear to be valid. Please choose another

    or a dialog titled "Select the certificate you want to use" that allows the user to select from an empty list the certificate they want to use to secure the connection.

    Cause:

    This error is caused by when a user connects using a domain name other than their configured yourname.homeserver.com name that the server's certificate is configured for.

    Solution:

    Connect to the Home Server using the yourname.homeserver.com domain name instead of another one unless a certificate has been generated for that name as well.

  • More unethical behavior from Dozier Internet Law

    Sadly my attention has been drawn away from the Dozier Internet Law vs The Free World battle online, and as a result seeing my Google ranking drop a bit over the last 5 weeks (weeks 1, 2, 3, 4, 5) for related queries I decided I needed to check the status of things... and boy did I find another whopper.

    I've discovered that our friends over at Dozier Internet Law continue to engage in unethical behavior... this time attempting to pollute the Google search results with garbage domain names.

    Despite doing all of their business at www.cybertriallawyer.com, they own a number of other domain names including:

    Up until a few weeks ago some of those domains simply pointed to their main web site... now though all are doorway pages with a combined 8433 words of Google deceiving text between three different web pages (www.dozier-internet-law.info redirects to www.dozier-internetlaw.org) with largely similar, but reorganized content to what is found on their main site.

    It has become well known that Dozier Internet Law engages in behavior that is on questionable ethical and legal ground and rather than apologizing and/or stopping... they just ramp it up even more.

    What better way to show what a group of professionals they are to potential clients than by polluting Google in a manor that they frown upon while simultaneously giving even more ammunition to the very people they are trying to beat through these actions.

    Brilliant!

    Perhaps it would be in the best interest of Dozier Internet Law to read the Google's Webmaster Guidelines page before news of this unethical behavior gets out and those critical of it report it's actions to Google via it's Report a Spam Result page.

  • Why am I suddenly an expert on online polygraphs?

    A couple of years ago I blogged on a bit of spam I received that was advertising online polygraphs... a post that largely went unread until late last week when ~50% of my traffic suddenly was as a result of people doing (mostly) Google searches for 'online polygraph' and similar queries... mostly out of Canada.

    While I can understand why I show up so high on the Google listings... I'm forced to wonder why so many people are suddenly interested in the subject of online polygraphing, something I cannot imagine would be accurate without some fairly expensive USB devices for monitoring the test subject and a tester watching everything the test subject does via a camera.

  • New Home Server Add-in: Web Folders 4 WHS

    Windows Home Server provides an easy to use remote access mechanism that enables a user to upload and download files to/from ones Windows Home Server when they are not on their local network.

    One big problem... it's web browser based and one of the key paradigms users are used to does not exist... file and folder drag and dropping.

    My new add-in, WebFolders4WHS gives users a new browser based way to access their files, as well as letting them do it through the Windows Explorer shell and any other WebDav client that supports HTTPS.

    What it looks like

    This add-in adds a new Home Server Console tab which lets you choose which shares you want to allow access to via Web Folders:

    Main view of WebFolders4WHS

    A small settings tab is also added which provides basic information on the state of the add-in and allow you to set it up or remove it's configuration.

    Settings page of WebFolders4WHS

    When you move to the client side, a user can simply create a folder in My Computer (under Vista) or My Network Places (under XP), and in Vista an actual mapped network drive (complete with letter) can be created and used much like a local directory or share.

    My Computer in Vista

    What you need

    In addition to a simple installer as is required for most Windows Home Server add-ins, a Microsoft provided client-side update is required to enable secure access to the server.

    These files are available here:

    How it works

    This add-in is nothing more than a bit of glue that wires up a few Windows sub-systems such as: Windows UNC Shares, an IIS Virtual Directory, WebDav and the Windows Distributed File System. Because this add-in uses existing functionality, all existing user accounts and share permissions are maintained and remain in full effect when a user accesses files via a Web Folder.

    Also see: Windows Home Server Forums Discussion

  • WHS Developer Tip #6: Faster referencing

    Q: Is there a faster way to add a reference to a Windows Home Server assembly instead of manually navigating to where the actual files reside?

    A: The easiest way is to have the desired assemblies show up under the .NET tab of the Add References dialog:

    Add Reference Dialog

    Two things are required to achieve this, a local copy of the assemblies and a registry tweak.

    Copying

    If you haven't already, it's a good idea to just grab the entire C:\Program Files\Windows Home Server\ directory from your Home Server and copy it to your development machine for easier referencing and reflection.

    Configuration

    To add the necessary registry key:

    1. Launch regedit

    2. Navigate to the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx

    3. Create a new key (folder) named 'Windows Home Server'
    Note: You can name this key anything you want.

    4. Change the default value to the path where the Windows Home Server assemblies exist on your development machine

    When all done you should have something that looks like this (the actual path will depend on where you have the files located):

    AssemblyFoldersEx\Windows Home Server key

    For more info on displaying assemblies in the Add References dialog, see this MSDN article.

    Configuration Alternative

    A slightly quicker alternative is to download, modify (and use) this registry file to point to the directory on your development machine where the assemblies live.

    Note: When you change the path to match the location on your machine, make sure that drives and directories are separated by two backslash characters instead of one as is normally seen in Windows (ie '\\' vs '\'). This is only required when modifying a registry file, not when using regedit.

    Usage

    Once the key has been added, re-launch Visual Studio, open or create a new project and launch the Add Reference dialog to be greeted with your new additions.

    Benefits

    Perhaps the greatest advantage of adding this key is that when you create a new project from a template that references a number different assemblies that you would ordinarily have to reference yourself (such as a Home Server Add-in) is that Visual Studio will automatically find the references assemblies for you based on this and other registry keys.

    Drawback

    One drawback of pointing the created registry key to a directory that contains all of the files from the server... is that all of the .NET assemblies show up in your Add References list. As nifty as it is to have ready access to the official files such as HomeServerExt.dll and Microsoft.HomeServer.SDK.Interop.v1.dll, we really don't need ready access to the Xceed libraries that you and are not licensed to use.

    Applicability

    Despite the fact that Visual Studio 2008 targets the new 3.5 Framework as well as the year old 3.0, this registry tweak still works as both 3.0 and 3.5 uses the 2.0 Common Language Runtime which this tweak targets, meaning it works just as well under 2008 as it does under 2005... as well as the Express edition and version of your choice.

    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.

  • WHS Developer Tip #5: Images and Icons

    Q: How can I use some of the pictures and icons that are used by the Home Server Console?

    A: Rather than violating the EULA and ripping the images you want straight from the files that came with Windows Home Server (which is certainly possible)... you can look to the CommonImages class (Microsoft.HomeServer.Common.Client, WHSCommon.dll) and it's 71 public static properties (69 of which return something), each of which returns different icon or image that can help you better theme your add-in.

    Here are some of the available images:

    ImagesAndIcons

    One unfortunate limitation of CommonImages is that some of the more sought after icons like those used for add, delete, edit and properties are not present... however a green check and red x are.

    You could randomly guess which is which... or you can use one of these two applications (C# or VB) which displays them.

    CommonImages Example Application

    With any luck, eventually Microsoft will make available (either officially or unofficially) more of the art used in the Home Server Console so that developers can better integrate visually with it.

    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.

  • Edge cases and polishing

    Some say that that the majority of developers are psychologically incapable of adequately testing their own code (outside of unit testing) because subconsciously they know where their program works and where it doesn't and will avoid straying from the path so that their program keeps working great.

    I admit it... I'm one of those developers.

    Right now I'm having the fun of forcing myself down random paths to test strange edge cases for my new Windows Home Server add-in... cases that it would be more than fair for me to just say say "Sorry, but you did something I told you not to do and now this add-in cannot clean up after itself"... but I'm not.

    Technically everything I am doing is unsupported by Microsoft as I'm using a number of Windows subsystems that shouldn't ordinarily be used by a Windows Home Server user... in fact normal use of them could even violate the end user license agreement.

    What I'm trying to do this evening is do my best to make sure that even if a user enables DFS and dinks around with that or other such systems, I'm able to gracefully handle dang near anything the user might have done.

    That being said... grrr.

    Once I've got those edge cases accounted for... I need to improve my logging and I'll be all set.

    </rant>

  • WHS Developer Tip #4: Project Templates

    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.

  • 24: The Unaired 1994 Pilot

    Jack Bauer saves the world with AOL 3.0.

    If you'll excuse me... I need to go dry my eyes.

  • Q Home Server Install Doc

    I was browsing around some of the nooks and crannies of my Home Server this evening and ran into a file named readme.txt (located in C:\Inetpub\remote\readme.txt) which said:

    Q Home Server Install Doc

     

    To install remote access for Q Home Server follow these steps.

    1. Run RemoteAccess.msi
    This will install the website

    3. Run dsa.msc and create a user
    If you want a user to have remote access, add them to the "Remote Desktop Users" group

     

    4. Configure your router
    Setup your router to forward ports 80 and 4125 to the Q Server.

     

    5. Using a web browser, navigate to your external ip address and use Microsoft Home Server Remote Access
    https://myServerName/Remote

    While it's clear that this file pre-dates the initial beta of Windows Home Server and probably should have been removed sometime between then and now, one has to wonder just how old it's instructions may be and for how long they were relevant (ie using dsa.msc to create a user).

    While the presence of this file isn't by itself important, it does go a long way to remind us though just how far WHS has come and how polished it has become, that now even for setup a user never has to touch the actual home server desktop.

  • Survey says... It needs your input

    As part of his eternal studenthood (with the current phase occurring at UNL), Dan over at tdaxp has put out a call for participants for a 30 minute survey that focuses on Creativity and Blogging.

    Do you have 30 minutes you don't mind burning for the cause of science? No? Come on, it's easy and it helps out with something that is described as:

    This is a research project to study the correlation between cognitive, affective, and behavioral attitudes on creativity in the domain of blogging.  (“Blogging” refers to maintaining an informal, chronologically sorted online journal.) 

    Then stop on by and take the survey.

  • Grumble Grumble Visual Studio bugs

    Off and on for the last couple of days I've been playing around with making Visual Studio project templates and customizing them with Template Parameters and ran into a little issue... the assembly name template being specified in the larger template is simply ignored.

    What does that mean? If I create a custom template with the AssemblyName tag being specified as say... Xyz.$safeprojectname$, and create a project named "My Test Project" based on it... the resulting assembly name is "My Test Project", not Xyz.My_Test_Project as that syntax would generate for a namespace... even on a fully patched copy of Visual Studio 2005.

    From the looks of it this has been bugged before on Connect... but ultimately closed as not reproducible.

    Thinking I can show how to reproduce it.. I've submitted it myself: Custom AssemblyName tag ignored in template.

    There still exists a problem... the same issue exists in at least Beta 2 of Visual Studio 2008. Someone first pointed it out in April 07 as existing in the March CTP, and in my testing it seems that this still exists... so it to has been bugged.

    Grrr.

    Double Grrr I suppose when it sounds like Beta 2 will be the last publicly available version of Visual Studio 2008 before they RTM so there will be no way for me to know if this bug has/will be fixed by then.

  • WHS Developer Tip #3: Intellisense

    Q: How can I make Visual Studio provide more useful Intellisense support for the Windows Home Server SDK?

    A: In order to get Intellisense support in Visual Studio a developer needs an xml file that contains all of the xml comments from the original code, something that was likely used to create the documentation available on MSDN today... unfortunately no such xml files have been made available for Windows Home Server from Microsoft, instead developers are forced to go without or make them themselves.

    Based on the documentation on MSDN, I have created a pair of xml documentation files for both HomeServerExt.dll and Microsoft.HomeServer.SDK.Interop.v1.dll which are available for download here.

    In order to use these them, you will need to extract the two xml files to the same directory where HomeServerExt.dll and Microsoft.HomeServer.SDK.Interop.v1.dll live on the machine you are developing on:

    DocumentationNextToSDKAssemblies

    Once extracted, you need only add a reference to one (or both) of these assemblies (that sits next to the associated xml file) in Visual Studio and the documentation will be there for you.

    Note that if you want to use this documentation in an existing project, you will first need to delete the references and then re-add them.

    Regardless of if you are writing your add-in in C# or VB.NET, once copied and (re)referenced, you'll turn this kind of view:

    IShareInfo with out description

    into this one:

    IShareInfo with description

    Note: These files have been tested in Visual Studio 2005 and 2008 Beta 2 in both VB and C#.

    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.

  • Windows Home Server: Client-Side SDK

    As reported elsewhere (MS Windows Home Server and Windows Home Server Blog), there is a new video on Channel 9 (as well as one on on10.net with Charlie Kindel) that is a sit down with Home Server Lead Developer Chris Gray (get back to the blogging man!) where he talks about building add-ins for Windows Home Server.

    What hasn't been reported anywhere else is that Chris also mentioned a client-side SDK for Home Server and when I asked about it Home Server General Manager Charlie Kindel chimed in and said in part:

    Chris sorta "mis-spoke" and "let the cat out of the bag" when he talked about the client-side SDK stuff.

     

    We are working on it.

     

    We have not announced when it will be released in pre-release form.

     

    We have not announced when it will be released in the product.

    Great to hear it's being worked on and so long as it gives the same kind of access to WHS as the functionality in Microsoft.HomeServer.SDK.Interop.v1 does on the server I'll be thrilled.

    If they give us a way to first put client-side code on the server and then deploy it to clients automatically... I'll be ecstatic.

    Granted the first bit is more likely in a V1 product than the second... a dev still has to hope.

More Posts « Previous page - Next page »
Powered by Community Server (Commercial Edition), by Telligent Systems