# Regenerate Your Project for better Debug / Release settings in both Lazarus and Delphi (and to be prepared for secret features coming next week)

**URL:** https://forum.castle-engine.io/t/regenerate-your-project-for-better-debug-release-settings-in-both-lazarus-and-delphi-and-to-be-prepared-for-secret-features-coming-next-week/1263
**Category:** News
**Created:** [July 7, 2024, 11:45am UTC](https://forum.castle-engine.io/t/regenerate-your-project-for-better-debug-release-settings-in-both-lazarus-and-delphi-and-to-be-prepared-for-secret-features-coming-next-week/1263 "2024-07-07T11:45:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [July 7, 2024, 11:45am UTC](https://forum.castle-engine.io/t/regenerate-your-project-for-better-debug-release-settings-in-both-lazarus-and-delphi-and-to-be-prepared-for-secret-features-coming-next-week/1263/1 "2024-07-07T11:45:08Z")

</div>

| [![Regenerate Your Project](https://castle-engine.io/wp/wp-content/uploads/2024/07/city_regenerate-200x112.png)](https://castle-engine.io/wp/wp-content/uploads/2024/07/city_regenerate.png "Regenerate Your Project") |

The summary of this post is: Download [latest engine](https://castle-engine.io/) and use _“Code -\> Regenerate Project”_ menu item in the [editor](https://castle-engine.io/editor). It will regenerate the files inside your project (DPR, LPI, DPROJ, and `CastleAutoGenerated.pas` unit).

We’ve made a few improvements to them, and all together it means we strongly advise you to regenerate your project. The improvements are outlined below, though their real “big outcome” is to unlock 2 new features I will announce in further news posts 🙂

Notes:

- As always, using the _“Code -\> Regenerate Project”_ is not strictly required by us. 

Just recommended, esp. if you develop a regular game following our _“New Project”_ templates, and most examples, as seen in [cross-platform manual](https://castle-engine.io/manual_cross_platform.php). In such case, we advise you let us auto-generate your project files (as above: DPR, LPI, DPROJ, and `CastleAutoGenerated.pas` unit) and you only focus on putting code in units (like `gameinitialize.pas`, views, and of course as many additional units as you need).

But if you develop something non-standard (like a Lazarus LCL or Delphi VCL / FMX application using [TCastleControl](https://castle-engine.io/control_on_form)) then you may prefer to manage the project yourself, manually. That’s cool too, engine will work perfectly, you will just have to activate some features explicitly, like starting logging (by `InitializeLog`) or debug features (by `ApplicationProperties.InitializeDebug`).

- Note that you can also do this [from command-line](https://castle-engine.io/build_tool): run `castle-engine generate-program`.

- As always for development, we recommend you have a backup, actually use a version control (like GIT, backed by a server like [GitHub](https://github.com/) or [GitLab](https://gitlab.com/)) and check the differences caused by the regeneration. If you’re not using version control yet, you really should start :), there are lots of self-hosted and “cloud”-hosted options, also free, even for private (not public) projects.

After this long introduction, the things we improved:

1. Newly generated Lazarus (LPI) projects include _Debug / Release_ build modes, that set common optimization/debug flags and define `DEBUG` / `RELEASE` symbols.

This is consistent with what our build tool has been doing since ~always and how we configure Delphi projects.

2. The `CastleAutoGenerated` unit now calls `ApplicationProperties.InitializeDebug` or `ApplicationProperties.InitializeRelease` depending on the `DEBUG` define when compiling the project.

3. We fixed mixed-up _Debug_ and _Release_ settings in auto-generated Delphi (DPROJ) files.

As usual for a long post without clear thing to screenshot, I just show something pretty 🙂 The screnshot comes from [Cyberpunk City (old project)](https://sketchfab.com/3d-models/cyberpunk-city-old-project-adfcc9e7552b4422a9c5eca3fb976cd3) by [carlcapu9](https://sketchfab.com/carlcapu9) licensed under [CC-BY-4.0](http://creativecommons.org/licenses/by/4.0/).
