Migrating From REGEN.BAT - Synergex/HarmonyCore GitHub Wiki

Migrating from regen.bat to the Harmony Core CLI Tool
If you’ve been using the regen.bat file to control code generation for your Harmony Core solution, you can easily move to the Harmony Core CLI Tool. The CLI Tool replaces regen.bat and provides a graphical user interface (GUI)for configuring and running code generation. With the CLI Tool, you can
- configure code generation options through an interactive interface.
- regenerate Harmony Core components without manually editing scripts.
- validate your configuration.
- add or update Traditional Bridge projects.
- synchronize generated code with your Visual Studio solution.
For an overview of the tool and its capabilities, see Introduction to the Harmony Core CLI Tool.
Steps to Convert Your Project
1. Verify File Locations
Ensure your Harmony Core solution includes one of the following files in its solution directory: regen.bat (or regen_config.bat for older projects). Note that this file must reside in the solution directory, not in a subfolder.
2. Open a Command Prompt in Your Solution Directory
From a terminal, navigate to the solution directory for your Harmony Core solution.
3. Launch the CLI Tool GUI
Run the following command:
harmonycore gui
The tool will display a “Loading Solution…” message while initializing.
4. Import regen.bat
Once the CLI Tool GUI opens:
-
Select File > Import from the menu.

-
The CLI Tool will import settings from your
regen.bat(orregen_config.bat) and related files--e.g., the Repository project,userDefinedTokens.tkn(if present), etc.
If the repository project is missing required NuGet packages, you may be prompted to allow the CLI Tool to resolve this.
The import converts the regen.bat file configuration into the new CLI Tool format, which is stored in Harmony.Core.CodeGen.json in the solution directory.
5. Confirm That the Import Was Successful
After the import completes, the solution directory should include a Harmony.Core.CodeGen.json file, the CLI Tool GUI screens should now display information for your solution, and the Structures tab should show any repository structures that were specified in regen.bat.
6. Save and Regenerate
-
Select File > Save to save your configuration.
-
Choose Codegen > Regen to regenerate Harmony Core code, or select Codegen > Sync VS to regenerate code and update your Visual Studio solution with generated files.
Once confirmed, you can archive or delete the old regen.bat file. Your project will now rely entirely on the CLI Tool configuration.