Matthew ".NET 247" Reynolds

Matthew Reynolds... software development consultant, author, speaker and trainer

  • Cool StringBuilder Tip (Rob McLaws)

    Rob McLaws offers a few thoughts about StringBuilder.  I've posted it here because I had a couple of things to add, and Rob's pointing out one of those classic "issues" with .NET.  The Framework often does so many useful things for us that we don't necessarily consider exactly how they work.

  • TLBIMP tip-o-the-day

    TLBIMP (the utulity for importingtype libraries into managed assemblies) allows you to define the namespace for generated classes. 

  • Stupid .NET Trick #174/B

    Add a LinkLabel called linkGoogle to a Windows Form Form...

    Set the Text property to http://www.google.com/

    Double-click on the control...

    Add this code:

    try
    {    
         System.Diagnostics.Process.Start(linkGoogle.Text);
    }
    catch(Exception ex)
    {    
        // whatever you usually do here, e.g. MessageBox.Show(this, ex.ToString());
    }

    Et voila - link label that shows IE navigated to the given page.

  • Strongly-named ActiveX Libraries

    On a simliar note to my previous post, you can strongly name ActiveX controls with more or less thing, i.e. /keyfile:, /keycontainer: and /delaysign switches.

    This command creates strongly-named Interop assemblies for Internet Explorer:

    AXIMP c:\windows\system32\shdocvw.dll /keyfile:c:\mykeys\key.snk

  • Strongly-named imported COM libraries

    When you import a COM library using the Add Reference option in VS .NET, the generated assembly is not strongly named. This will stop you from emitting the assembly that's consuming the COM library with a strong name.

    To fix this, use the TLBIMP utility in the .NET SDK. This can accept either a /keyfile:, /keycontainer: or /delaysign: switch that will enable you to control the key that is used to sign the assembly.

    TLBIMP c:\myapp\whatever.dll /keyfile:c:\mykeys\key.snk /out:Interop.Whatever.dll

    The /out: switch is particularly important here. By default, VS .NET prefixes its assemblies with Interop. To be consistent, you should do the same.

  • Build Processes

    In the past, I've struggled to explain to clients exactly why spending time putting together a build server that offers continuous integration is a good thing. The benefits seem to be highly ephemeral - it just feels to me like the process is working better.

    In his blog entry The Build Process, Jeff Reese talks about the build process he's just put together. It's quite a short entry, and worth a read.

    Of particular note:

    The up front time investment caused some people to question whether it was worth it, but as we grew and brought on new developers the build system quickly became a key tool in helping us to consistently and reliably produce a high quality product. Our projects were always completed ahead of schedule and we always delivered more than we promised.

    CVSNT, NAnt, and NUnit are great tools in their own right and work very well individually. By gluing them together with Draco.NET you get yourself a robust system capable of automating your builds, running tests, and notifying the appropriate parties. In short, you've covered the first three out of 12 items on the Joel Test (don't forget bug tracking).