65.9K
CodeProject is changing. Read more.
Home

Code Generation tools complementing generics

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.82/5 (5 votes)

Sep 26, 2004

viewsIcon

23170

downloadIcon

233

A palette of code generation tools for VS.NET.

Introduction

Over two years ago I discovered this deficiency of VS.NET IDE – lack of preprocessing for C# sources. At that time the solution was quickly found, and the palette of tools has grown since then.

Attached archive contains four code generators (with their custom tool names):

  • C preprocessor- “codegens.pp” to use MS compiler CL, or “codegens.cpp” for CPP (usually found in GNU tools packages like Cygwin).
  • PERL- “codegens.perl” (get installed as ActivePerl or via Cygwin).
  • Spawned process- “codegens.spawn”.
  • XSLT transformed XML- “codegens.xslt”.

Using the code

Simply register a pre-built assembly with “regasm/codebase codegens.dll” and you’re ready to use the custom tools.

I recommend you to start with samples.sln, which features all of the codegens.

Use is as easy as changing the “Build Action” to “Content” in file properties and typing in the desired codegen name (as listed above) in the “Custom Tool” field.

Background

Much of the IDE integration details were covered by BaseCodeGeneratorWithSite posted back on gotdotnet.com.