Code Generation tools complementing generics

Sep 26, 2004

1 min read

.NET1.0

.NET1.1

VS.NET2002

VS.NET2003

C#

Windows

.NET

Visual-Studio

Dev

Intermediate

Author picture

by cminusminus

Contributor

23k Views

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.

Article image

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.

Article image

Background

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)