views:

322

answers:

5

I have an old skool professor that requires that we print out all of our project source code for him to review. I am writing this app in VS 2008 and the solution contains a C# Web App and several Class Libraries (consisting of probably 100 files total).

Anyone have experience with a good method of printing out many source files like this? I'm doubting that you can take a solution into Kinkos...

+2  A: 

Write a macros in VS.

FFire
This is probably the best answer, though it should be elaborated upon. A simple macro to print the current document is .DTE.ExecuteCommand ("File.Print"). Add a loop to loop through all the files in the project; open the file; do the print; then close the file.
John Saunders
+2  A: 

I would write a quick script to append all of the source files together into one text file. Include 'breaks' that include file paths and names to delimit different source files. Then, just print the resulting file.

This method would cut down on time/paper waste.

tehblanx
+3  A: 

I tested these 2 batch files on my XP system against my project folder and it worked.

Batch file 1 - update to point to correct path - run this file after saving both batch files. I would save this one as doit.bat:

for /f "tokens=*" %%a IN ('dir /b /s "c:\temp\myrootcodefolder\*.*"') do call allmycode.bat %%a %%~xa

Batch file 2 - Update to include any extensions you need that I didn't list. Be sure to save as allmycode.bat

if %2.==. goto :END

if %2==.vb goto :OUTPUT
if %2==.cs goto :OUTPUT
if %2==.aspx goto :OUTPUT
if %2==.txt goto :OUTPUT
if %2==.config goto :OUTPUT
if %2==.asax goto :OUTPUT
if %2==.asmx goto :OUTPUT
if %2==.skin goto :OUTPUT

GOTO :END

:OUTPUT
echo. >> allmycode.txt
echo. >> allmycode.txt
echo ============================================ %1 >> allmycode.txt
echo. >> allmycode.txt
type %1 >> allmycode.txt

:END
rvarcher
A: 

Possibly more work than you're willing to put into this, but LaTeX together with the Listings package will provide you with paging, advanced formatting, line numbers etc. Including source code files is then a matter of adding such statements as:

\lstinputlisting{class1.cs}
\lstinputlisting{class2.cs}
Tormod Fjeldskår
+2  A: 

You could try using a VS plugin.

Some answers here: What is the best Visual Studio Plugin for Printing Code

Gulzar