Devart Blog

Integrating Review Assistant with MSBuild

Posted by on January 28th, 2014

Summary: This article contains information on how to integrate the Review Assistant code review tool into an MSBuild-based build environment.

This is the first article in a series of Integration Review Assistant with Continuous Integration Systems.

Why Use Continuous Integration?

If several developers are working on the project, from time to time they need to integrate their changes to the project’s code base. The developers also need to run builds to check if the new or updated code can be build successfully. These builds are called integrated builds. Normally, they are performed with a specified schedule.
It is quite difficult to find errors that occur in integrated builds that are performed occasionally, since the number of code changes introduced between the previous and current builds may be huge. To reduce the number of bugs in integrated builds and to make it is easier to find errors, integrated builds should be performed as often as possible. At the best case, builds should be performed right after the source code has been modified and reviewed.

Why Integrate Review Assistant with MSBuild?

MSBuild is a build platform for Microsoft Visual Studio applications. The platform uses XML-based project files that specify the actions to be performed during the build.
Review Assitant can be integrated into an MSBuild project to prevent the situation when unreviewed code is included in the scheduled project build. This may be useful when developers are not paying enough attention or even ignore code review process. Thus, it is possible to disable the automatic build, if during a specified period of time (for example 16 hours) there have been reviews with the “Rejected” status.

Declaring MSBuild Target in the Project File

Targets are declared in a project file with the Target element. For example, the following XML creates a target named CheckRejectedReviews, which then runs Review Assistant command line. It will check the reviews and call the Error Task in case of violations.


        $(MSBuildProjectDirectory)\ReviewAssistantReport.xml



        
        

        
        
            
        

        
        
        
        
    

The following is the sample command that can be used to integrate Review Assistant to the MSBuild project file:

ra reviews /server http://raserver:85 /ReviewAssistant /project "My Project"
 /xml /login Guest /status Rejected /ModifiedTill 16h

The command returns all the reviews that keep the Rejected status during a specified period of time.

Now you can call the CheckRejectedReviews target right from the continuous integration system you use.
In case you do not plan to get integrated with any continuous integration system, use the BeforeTargets property that indicates that this target should run before the specified target or targets.

Next articles will describe how to call the Target explicitly to integrate Review Assistant with CCNet and Jenkins continuous integration systems.

Conclusion

We’ve shown you an example of how you can integrate Review Assistant with MSBuild. Start using Review Assistant for free today.

3 Responses to “Integrating Review Assistant with MSBuild”

  1. Setting Up Review Assistant CCNet Integration Says:

    […] article in a series of Integration Review Assistant with Continuous Integration Systems. Read the Integrating Review Assistant with MSBuild article to get an additional information about the integration with continuous integration […]

  2. Integrating Review Assistant with Jenkins Says:

    […] article in a series of Integration Review Assistant with Continuous Integration Systems. Read the Integrating Review Assistant with MSBuild and Integrating Review Assistant with CCNet articls to get an additional information about the […]

  3. Carsten Says:

    Hello,

    you should really look at your casing since MSBUILD is case sensitive when it comes to XML nodes.
    anyway, trying this out currently.

    Carsten

Leave a Reply