CommentStripper: strip out xml comments and/or normal comments from C# code
A customer of ours asked me if there was an option in
LLBLGen Pro
to not generate XML comments into the generated code. As
there isn't such an option, I though it would be cool to
write a little command line app to strip out any xml comment
and/or normal comment from C# sourcecode. It might sound to
you like the most worthless piece of code ever cooked up, I
mean: why would you remove comments from your code, right?
. There are situations however, where you have to
distribute sourcecode to your client, but you don't want
your client to have all the comments, so in a way you give
the client the feeling they have the sourcecode, but they
also will have a hard time reading it.
My attempt to get such a command line app is available here:
http://www.xs4all.nl/~perseus/CommentStripper.zip
(5KB). It's C# sourcecode, and does basic comment stripping.
It's not able to strip out multi-line /* */ comments, I
leave that regexp voodoo requiring code to the reader
. I tested it on a large pack of code and it's very fast
and the code was even compilable afterwards
.
Happy strippin'!