Reduce Development Headaches With Draco.NET

Once you try this free continuous integration tool, you’ll wonder how you ever lived without it.

asp:ToolKit

LANGUAGES: All .NET Languages

TECHNOLOGIES: .NET Compilers | NUnit | NAnt

 

Reduce Development Headaches With Draco.NET

Once you try this free continuous integration tool, you'll wonder how you ever lived without it.

 

By Ken McNamee

 

If Stephen King were a Web developer, he might write about this nightmarish - but common - scenario: You're leading a development team working on an important Web project. The budget is tight, and the deadline is looming. Everybody is working feverishly, making changes and checking code in and out of Visual SourceSafe (VSS). At the end of every day you do a "Get Latest" from VSS, fire up Visual Studio .NET, build the project and ... BAM! The Task List fills up with so many compile errors in multiple files that you have no clue where to begin. You must sift through every error manually, hoping there was one root problem that triggered an exception cascade.

 

Your worst fears are confirmed as you realize fixing the build is not going to be easy; there are several distinct overlapping issues that multiple developers worked on throughout the day. So you huddle everyone together and try to hash out what went wrong. Then, as a last resort, you perform a code rollback and reintegrate the changes one by one as you work well into the night.

 

Visual Studio .NET is a great ASP.NET development tool, but I find it still lacks some facility in reducing a development team's headaches. Luckily, groups of programmers are out there creating free, open-source tools - using the .NET Framework - that pick up where Visual Studio .NET leaves off. I've written previously about NUnit and NAnt, which are used for unit testing and building and deploying, respectively. Draco.NET is a logical conclusion to this open-source trilogy because it actually works with NUnit and NAnt continuously to ensure the integrity of the code stored in your Visual SourceSafe database.

 

Take Two

So let me rewrite that nightmare scenario using Draco.NET: Your development team members are working feverishly - making changes, checking code in and out of Visual SourceSafe, and adding comments as they check the files in so it will be easy to see what changes they made. Draco.NET polls the Visual SourceSafe database periodically to see if any files were changed since the last time it checked. If a change was made, Draco.NET does a "Get Latest" to a temporary directory, invokes NAnt to build the project, runs the NUnit unit tests, and deploys the code to a test server. At the end of this process Draco.NET sends an e-mail to the team members notifying them of the changes that were made, using the comments in VSS, and letting them know whether the build was successful. If any steps in the process fail, Draco.NET includes the compiler output showing which files failed the build and the code line that caused the problem. Instantly, everybody can see there was a problem, what the problem was, and who needs to correct it. Pretty amazing, if you ask me.

 

Recently I worked on a development team that used Draco.NET extensively and I can honestly say it can provide some significant benefits in both developer productivity and sanity. So how does it work? It's actually quite simple. Draco.NET runs as a Windows Service that uses a .NET XML configuration file to determine which Visual SourceSafe databases to poll and how often to poll them. It also includes options for e-mailing the results. Figure 1 is an example of a simple Draco.NET configuration file.

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <configSections>

    <section name="draco"

     type="Chive.Draco.Config.ConfigurationSection,Draco"/>

  </configSections>

  <draco xmlns="http://www.chive.com/draco">

    <pollperiod>60</pollperiod>

    <mailserver>mail.yourcompany.com</mailserver>

    <fromaddress>[email protected]</fromaddress>

    <builds>

      <!-- Build using NAnt -->

      <build>

        <name>MyWebApp</name>

        <pollperiod>10</pollperiod>

        <notification>

          <email>

            <recipient>[email protected]</recipient>

          </email>

           <file>

            <dir>C:\Working\BuildOutput</dir>

          </file>

          </notification>

          <nant>

            <buildfile>MyWebApp.build</buildfile>

            <targets>StartTest</targets>

            <properties>

              <property name="property1"

                        value="value1" />

              <property name="property2"

                        value="value2" />

            </properties>

          </nant>

          <vss>

            <project>$/MyWebApp</project>

             <username>mark</username>

            <password>foobar</password>

            <ssdir>C:\VSS\MyWebAppDb\</ssdir>

          </vss>

        </build>

        <!-- Build using Visual Studio.NET -->

        <build>

          <name>MyWebApp</name>

          <notification>

            <email>

              <recipient>[email protected]</recipient>

            </email>

          </notification>

          <devenv>

            <solutionfile>MyWebApp.sln</solutionfile>

            <solutionconfig>Release</solutionconfig>

          </devenv>

          <vss>

            <project>$/MyWebApp</project>

            <username>mark</username>

            <password>foobar</password>

            <ssdir>C:\VSS\MyWebAppDb\</ssdir>

          </vss>

        </build>

      </builds>

    </draco>

  </configuration>

Figure 1. Like ASP.NET, Draco.NET uses an XML configuration file to control which Visual SourceSafe databases to poll for changes, how often to poll them, and where to e-mail the results.

 

The key elements in the configuration file are the <build> elements, which allow Draco.NET to poll multiple Visual SourceSafe databases using different settings including the <pollperiod>. The <pollperiod> shown in Figure 1 is assigned a global position outside the <builds> node, but you also can set it inside each <build> element. Notice that the first <build> element has a <nant> node that specifies which NAnt build file to use and also sets targets and properties. The second <build> element has, however, a <devenv> node that allows Draco.NET to use Visual Studio .NET to build the Web application using the solution file. This is convenient if all you need to do is get and build the latest code from Visual SourceSafe without running unit tests and deploying the project. This saves you from installing and configuring NAnt if you don't need NAnt's additional features.

 

Believe me when I say Draco.NET can save you a lot of frustration and wasted time. It does what a computer does best: It accomplishes a tedious, repetitive task faster and more efficiently than a person can. I would say Draco.NET is worth every penny ... but it's free, so that doesn't quite fit. But because time is money, I can say with confidence that it's definitely worth your time to download and use it on a trial basis. Draco.NET is easy to download, install, and configure. And once you grow to depend on it, it will be hard to live without.

 

References

 

Ken McNamee is an independent consultant who works with companies in need of highly scalable, data-driven Web applications. And who doesn't need one of those these days? Prior to this, he led a team of developers in re-architecting the Home Shopping Network's e-commerce site, HSN.com, to 100 percent ASP.NET with C#. E-mail him at [email protected].

 

Tell us what you think! Please send any comments about this article to [email protected]. Please include the article title and author.

 

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish