Thursday, January 20, 2011

.NET Preprocessor Update

NTSTATUS: STATUS_DOTNET_MACRO

Latest versions:

  • DOTNETPP Version 0.1.12.0
  • VSDotNetPP Version 0.1.3.0

As before, they can be downloaded here.

VSDotNetPP now implements DOTNETPP and does not call DOTNETPP.EXE, but it is still included in the install anyway. This update fixes some bugs and makes some processing changes (supposedly for the better). Following are the specific feature updates.

Features Updated In The .NET Preprocessor

The setting for <MacroFilePath> now accepts a directory (path), and parses all .npp files for macro definitions. Or, you can just specify a file path (does not have to have a .npp extension).

A list of the source files processed is kept temporarily to avoid restoring files unecessarily during the cleanup process. It was an annoyance otherwise.

Other than that, some bugs have been fixed.

Features Updated In The Visual Studio Add-In

A new setting has been added: Close and re-open source files with macros during build



I added this setting because I was getting annoyed at the source files getting closed. It’s OK if you have one or two, but it’s not OK if you have more open. Also, I think it should be obvious that the main problem with the closing/opening is that it currently does not return you to the same spot in the file you were in.

I recommend the following settings in the image:

  • NOT restore macros in source
  • NOT close/re-open the source files
  • Cleanup expanded source

By using these settings, it’s pretty much the same as using DOTNETPP in your pre-build and post-build events. But with the way it is currently, it works the best. So to do a build, you’d have to build twice. The first build expands the macros, and you have to say YES when Visual Studio asks if you want to reload the files (source changed the Preprocessor). I just build when I want to expand the macros.

Finally

This is pretty much it for the time being. I’ve been using it and it’s been working well. I also found it was quite useful for SQL scripts as well. It managed to reduce some copy/paste/edit.

Here’s a useful macro for the ternary operator:

#define HASVAL(a) a.HasValue ? a.Value : 0

IntelliSense does not do regions:

#define REGPRV

#region Private

#endregion

No comments:

Post a Comment