Creating Code Nanite Source Files

The fact that CodeStencil does not have an inbuilt template language is what gives you the flexibility to create your own.

In this example, we want to create a set of Date Utilities that we can use to timestamp our code when we generate it. To do this we need to create  a plugin Code Nanite and we already have a stencil that will generate the necessary Visual Studio solution complete with the classes and resources. \

First, we need to create a CodeStencil project using the CodeStencil Nanite Template stencil.

Step 1 -  Create the project

Step 2 - Name the project. We will call the project - DateUtilities


Step 3 - Fill the project details. See Project Properties for more explanation.

Note: The stencil selected is the CodeStencil Nanite Template stencil.


Once you click OK, you will see the project created as shown below.


Step 4 - Update the Expanders with correct and relevant strings. See Expanders for more information on how expanders work.


  Expansion Label Expansion String Comments
1 ASSEMBLY_DESCRIPTION   Creates Code Nanites for Date Utilities
2 ASSEMBLY_TITLE     Date Utilities  
3 ASSEMBLY_NAME     DolaSoft.DateUtilities  
4 CODE_NANITE_LABEL     GetCurrentDate  
5 CLASS_NAME     DateUtilities  
  NAMESPACE     CodeNanites  
  PROJECT_NAME DateUtilities  
12 OUTPUT_FOLDER   Your output folder (which is updated from Project Properties) should point to the same development folder where the Stencil resides. See Folder Structure

ASSEMBLY_DESCRIPTION and ASSEMBLY_TITLE will be generated in the strings shown below in the Assemby.cs created in the Visual Studio project.

ASSEMBLY_NAME is generated into the Assembly Name field under project properties:

You can see below the where the expanders updated in Step 4 are reflected in the generated code:

About CodeStencil

CodeStencil is Published and Marketed by Zera Systems Inc.

© 2018-2019 CodeStencil - Zera Systems Inc. All Rights Reserved.

No