Batch building NDoc projects#

If you're not using NAnt or another NDoc-enabled build tool for your build cycle, you might find this little batch file useful:

@ECHO OFF
REM Set the full path to the NDoc console executable.
SET NDOC="C:\Program Files\NDoc 1.3\bin\net\1.1\NDocConsole.exe"
REM Set the relative path to the output directory.
SET OUTPATH=doc
REM Loop over the NDoc project files (*.ndoc).
FOR %%P IN (*.ndoc) DO (
 ECHO Generating documentation for "%%~nP"...
 ECHO.
 REM Run NDoc for the project file.
 %NDOC% -project=%%P
 REM Copy output files to the current directory.
 MOVE %OUTPATH%\*.chm .
 REM Delete output directory.
 RMDIR %OUTPATH%
 ECHO.
)

This will just loop over all .ndoc files in the current path and build the documentation for it into a 'doc' directory. Then it will move the generated .chm Windows help file to the current directory and delete the output directory again so you only have the .chm file left and not the temporary files.

What I thought was pretty cool is that you can use batch files to loop over a fileset like *.ndoc using the "FOR %%P IN (*.NDOC) DO (...)" syntax. Inside the bracket scope, you have the %%P variable which will be expanded to the current file in the loop, and you can use %%~nP to get just the filename without the extension. There are a lot more of these substitution enhancements, just type "help for" in your favorite command shell.

For some more batch magic, see Raymond Chen's 90-byte solution to search for a file in your PATH. Nifty!

Friday, December 15, 2006 9:53:13 AM (Romance Standard Time, UTC+01:00)
Cool!<a href="http://www.chinatraderonline.com/DIY-Tools/Pliers/">piler</a>
Comments are closed.
All content © 2012, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 350
This Year: 0
This Month: 0
This Week: 0
Comments: 530
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In