Installing & Configuring CodeGen

 

Requirements

CodeGen is a Synergy .NET application and is always built with the latest version of Synergy that is available at the time that a CodeGen release takes place. To install CodeGen your system must have:

Microsoft .NET Framework 4.5 (or higher) installed.

Synergy/DE runtime components (both 32-bit and 64-bit if installing on a 64-bit system).

Access to a Synergy runtime license (e.g. RUN10).

Downloading CodeGen

CodeGen can be downloaded from CodePlex as either a pre-built Windows Installer package, or as a source code package that you must build yourself. You can access these downloads here:

Windows Installer Package

Source code package
 

Installing CodeGen

If you downloaded the Windows Installer package then simply execute the installer and respond to the various prompts. We recommend accepting the default responses to most questions, which will perform a full product installation. We also recommend entering your actual name and company name when prompted, because the responses to these questions are used to provide values for the <AUTHOR> and <COMPANY> tokens, and so could appear in source code that you may generate.

System Environment PATH

For the best experience the main CodeGen installation folder should be included in the system PATH.. By default the CodeGen installer takes care of this.

Setting Environment Variables

There are several environment variables that you can set in order to configure an appropriate environment for CodeGen. These environment variables are discussed below.

You can set these environment variables in one of the following ways:

1)In your actual system environment.

2)In your current process environment.

3)In the [codegen] section of your synergy.ini or synuser.ini file.
 

Environment Variable

Comments

CODEGEN_TPLDIR

Determines the default location of template files. If you don't set this environment variable then CodeGen will default to the "Templates" folder below the main folder that you installed CodeGen into. This folder contains sample templates that ship with CodeGen.

You can override CODEGEN_TPLDIR by using -i command line option.

CODEGEN_OUTDIR

Determines the default location where output files generated by CodeGen will be created. If CODEGEN_OUTDIR is not set then CodeGen will default to creating output files in the current directory.

You can override CODEGEN_OUTDIR by using the -o command line option.

CODEGEN_AUTHOR

Determines the value inserted into generated code when the <AUTHOR> token is processed. When you install CodeGen you are prompted to enter your name and this value is stored in the Windows Registry and used to provide a default value for CODEGEN_AUTHOR. You can override this behavior by explicitly setting CODEGEN_AUTHOR.

If CodeGen is unable to determine the name of an author then the name "CodeGen" is used.

CODEGEN_COMPANY

Determines the value inserted into generated code when the <COMPANY> token is processed. When you install CodeGen you are prompted to enter your company name and this value is stored in the Windows Registry and used to provide a default value for CODEGEN_COMPANY. You can override this behavior by explicitly setting CODEGEN_COMPANY.

If CodeGen is unable to determine the name of an author then the name "Synergex" is used.

CODEGEN_EXTDIR

If you have created custom extensions for CodeGen then this environment variable allows you to specify the folder where CodeGen will search for custom extensions assemblies.

SYNDEFNS

The SYNDEFNS environment variable can be used in your Synergy development environment to determine the default namespace that items are added to when performing strong prototyping. CodeGen will also use the SYNDEFNS environment variable to determine the default value to be used when the <NAMESPACE> token is processed.

You can override this default behavior by using the -n command line option.

CODEGEN_STRIP_FROM_PROMPT

Developers sometimes encode information into repository field prompts and then pre-process the prompts at runtime before they are displayed within a UI Toolkit application. One common example is when developers want to display field numbers in UI Toolkit input windows. In this case, prompts in the repository might be configured as "xx Customer name", and the developer could then execute code to replace the xx characters with field numbers based on the fields position within an input window or set. This can be a problem when using the field definitions in other environments, so CodeGen has the ability to strip a known pattern of characters from any field prompt where that pattern is found. For example, if some or all field prompts are prefixed with the characters xx<space> then you can tell CodeGen to remove these characters by setting the following environment variable before code generation:

set CODEGEN_STRIP_FROM_PROMPT = "xx "

NOTE: you must delimit the text to be stripped with two double quote characters, otherwise CodeGen will not make any changes to field prompts.

CODEGEN_DATABASE_TYPE

 

Specifies the type of relational database that code is being generated for, by customizing the values inserted by the field loop expansion token <FIELD_SQLTYPE>. Supported values are SQLServer, MySQL and PostgreSQL. Also refer to the command line option -database, which if used will override any value set by CODEGEN_DATABASE_TYPE. Without either of these options being used the default database type is SQLServer.

 

Rebooting After Installation

The CodeGen installation modifies the system wide PATH environment variable, and some versions of Windows require a reboot for this new setting to take effect. We recommend that you reboot your PC after installing CodeGen for the first time.

Updating CodeGen

Recent versions of the CodeGen installation support upgrading to a later version, so in most cases an older version of CodeGen will be automatically removed when you attempt to install a newer version. It should not be necessary to reboot your system after an upgrade.

Uninstalling CodeGen

CodeGen can be removed from your system via an Uninstall shortcut which is added to the Windows Start Menu, or via the "Programs and Features" application in the Windows Control Panel.

 

 

 


Copyright © 2018  Synergex International, Inc.