LeMP is an open-source project to add lexical macros to C#. This extension provides a single-file generator that you can use inside a normal C# project to add individual source files that rely on macros.
Macros are ordinary C#/.NET methods that run at compile time. They take a code snippet as input and produce another code snippet as output. For example, when LeMP sees this code snippet:
LeMP realizes that it should call the macro represented by the
Currently, the main focus of LeMP is giving you a useful set of macros out-of-the-box. It's also possible (and encouraged) to write new macros.
Note: although LeMP can be configured to run at compile-time, technically when using this extension, LeMP runs whenever you save a source file associated with the LeMP Custom Tool, which is actually before compile time. It is also possible to set LeMP.exe as a pre-build step so that it actually does run at compile time. If you are using the LeMP custom tool, you should commit your *.out.cs files into source control since they are not produced during builds. This approach has the advantage that your build server does not need to have LeMP installed.
Note: Older versions of Visual Studio are supported but require special installation steps, see here.
Learn more at the LeMP home page. Visual Studio 2008/2010/2013 is only supported up to version 2.6.2.