The ConfigZilla Document Comment (and finding git.exe)

When ConfigZilla generates your .config file it stamps the document with two comments that look like this:

<!-- Built using configuration Release on machine NOFANWINBOX by Phil at 22-Feb-2014 16:23 -->
<!-- Last Git commit was e43b124d78c92ea27f971dbb80962efa435b8c46 on branch master -->

The Git comment only displays if you have Git, of course (see below for how to tell ConfigZilla where git is located if it is not in your path). If you don't like these comments you can change their format or even suppress them completely. There is also a third comment reserved for your use.

The czComment properties

There are 3 MSBuild properties called czComment1, czComment2 and czComment3. To set them, create a file called "ConfigZilla.user" in the root of the ConfigZilla project. This is an MSBuild file. Set Build Action to None and Copy to Never. Add your own definitions for the 3 properties:

<PropertyGroup>
    <czComment1>I wish I had found...</<czComment1>
    <czComment2>ConfigZilla sooner!</<czComment2>
</PropertyGroup>

You can use any MSBuild properties you would like. For example, the default comment is formed from this expression:

<czComment1 Condition="'$(czComment1)'==''"> Built using configuration $(Configuration) on machine $(ComputerName) by $(UserName) at $([System.DateTime]::Now.ToString("dd-MMM-yyyy HH:mm")) </czComment1>

To completely suppress czComment1 or czComment2 set its value to "none". czComment3 is blank by default and won't appear unless you set it to something.

<PropertyGroup>
    <czComment1>none</<czComment1>
    <czComment2>none</<czComment2>
</PropertyGroup>

Locating Git

If git.exe is on your path stop reading now - ConfigZilla will find it automatically. If it isn't then you need to tell ConfigZilla where to find the exe. ConfigZilla first checks the "czGitExe" MSBuild property. You can set this to a semi-colon separated list of paths to check in your ConfigZilla.user file:

<PropertyGroup>
    <czGitExe>C:\Somewhere\git.exe;C:\Elsewhere\git.exe</<czGitExe>
</PropertyGroup>

The property is a list so that you can cope with different users having git installed in different places. The disadvantage of this technique is that you have to set it in every project which is using ConfigZilla.

If ConfigZilla can't find git from your czGitExe it then goes on to check for an environment variable called CZ_GIT_EXE. Again, this is a semi-colon separated list of paths to try. Next, ConfigZilla will check "C:\Program Files (x86)\Git\bin" which is the default installation folder for MSysGit. Finally, if none of those work, ConfigZilla will just try running git.exe to see if it is on your path, and if all of those fail you will get a warning in the build window and your git comment will be blank.


Table Of Contents