2 minute read

A tip that not a lot of people know is that the samples are not reset during every new release of CodeSmith Generator. New versions of templates are added to the CodeSmith Generator template directory for the Major and Minor versions. However that is not the case for regular builds (identified via the assembly build number) for example: 5.3.x. Please note that this will also work if you want to reset your templates for the fun of it.

You might be asking yourself, well why doesn’t CodeSmith Generator automatically update my templates for me. Well there is a pretty good reason behind this. There is no way to know if you modified the current set of templates on your machine. If we were to just overwrite the files with the new templates that contain bug fixes, you could lose a lot of unsaved work.

So if you are experiencing a template related bug and you didn’t cleanly install CodeSmith Generator for the very first time on your machine. The chances are your templates are out of date and need to be saved manually and updated following the steps below.

The following steps below will reset your samples to the version that of CodeSmith Generator that you updated to, or installed to. If the samples still do not show up in CodeSmith Generator Explorer. Then you can find the sample templates located in two zip files: samples.zip and maps.zip, located in Program Files\CodeSmith folder, and you can extract these to the correct folder inside of you’re my documents folder (Documents\CodeSmith\Samples\v5.3\Templates).

PLEASE CREATE A BACKUP OF ALL YOUR TEMPLATES BEFORE PROCEEDING!!!

First you will need to exit all CodeSmith Generator related applications (CodeSmith Generator Studio, Visual Studio) and follow the steps below.

  1. Open the Windows Run dialog box by hitting the Windows Key and R. or by going to the Start menu and clicking on run. or start -> run) dialog box and type cmd and click the OK key.

    Windows Run Dialog

  2. Next type cs /resetsamples into the Command Prompt window and hit enter.

  3. Finally type y to confirm that you want to reset your templates and hit enter. Reset Samples

Congratulations your CodeSmith Generator templates have been reset.

Join the mailing list

Get notified of new posts and related content to your inbox. I will never sell you anything and I will NEVER sell your email address.