T4 Templates and Null in Expression block

Another annoying issue with T4 templates is its support for nulls. If you have template Both design-time and runtime templates will fail with And this is very annoying because sometime you are calling external functions and you don’t want to check for nulls all the time. It is unacceptable. So I decided to change base […]

T4 Runtime Templates Base Class

Unfortunately out of the box T4 Runtime templates in Visual Studio have some issues Let’s discuss these issues one by one. Issue with base classes When we create RuntimeTextTemplate1.tt Visual Studio automatically generates nested C# file which contains RuntimeTextTemplate1 and RuntimeTextTemplate1Base classes. RuntimeTextTemplate1 class contains actual generation logic generated from tt file. But RuntimeTextTemplate1Base class […]

T4 Syntax

MSDN has an article which describes T4 syntax with details. I will quickly describe it Visual Studio 2012 supports two types of project items: Text Template aka Design-time Text Template Runtime Text Template aka Preprocessed Text Template T4 template can contain directives, text blocks, standard control blocks, expression control blocks and class feature control blocks […]

[PowerShell] Built-in support for -Debug and -Verbose for your scripts

Here is very good article about adding support for so-called Common Parameters such as -Verbose or -Debug Short overview of the article above To enable support for Common Parameters you need to add the following snippet on top of your script So now you can invoke If you don’t like the fact that your script […]