Automating Command-Line builds using MSDEV.exe

0 Likes

Problem:

How to use the "msdev.exe" command-line options to build with BoundsChecker for Visual C ?

Resolution:

Currently, you can use a Visual Studio 6 macro to automate command-line builds using msdev.exe. Use the following steps to prepare this:


  1. Inside Visual Studio 6, choose File > New > create a Macro File.
  2. Add the following code to the macro file:
    Sub NMBCBuild() 
    'DESCRIPTION: Instruments your project with BoundsChecker. 
    ExecuteCommand "BCBuild" 
    End Sub 
  3. If you would like Visual Studio to exit after doing the build, also add the following code. (Note: Having this macro enabled will quit Visual Studio whenever you finish building. If you do not conditionalize this, you should disable your macro file when not needing to automate BoundsChecker builds.)
    Sub Application_BuildFinish(nNumErrors, nNumWarnings) 
    'DESCRIPTION: Triggered when Visual Studio finishes any build. 
    'Exit Visual Studio. 
    Application.Quit 
    End Sub 
  4. Save the file and go to Tools > Customize > > Add-ins and Macro Files tab.
  5. Browse to the macro file you saved, and be sure that it is checked on the left. This will automatically load the macro file on starting Visual Studio sessions.

Now, in order to build a Project's Active Configuration from the command-line, you would use the following syntax:

msdev.exe foo.dsw /ex NMBCBuild 

If every step above was followed, this would perform a BoundsChecker build of the project and then exit Visual C . Other automation code can be used for changing the Active Configuration, or saving the build output text. For more information on "msdev.exe" command-line builds or Visual Studio macros refer to Microsoft's Visual C User's Guide.

This technique can be used with BoundsChecker 6.0 and later.

Old KB# 11012
Comment List
Anonymous
Related Discussions
Recommended