Cleaning projects

Cleaning a project deletes the generated code that is already existing for a →target system. All build problems and built states will be discarded. The project will be rebuilt from scratch meaning that the code for the target system will be created from scratch, based on the →resources in the →project.
If the project has been cleaned but code has not been created anew, you will not be able to load the application onto the target system. See troubleshooting article "Cannot build or load application".

  • If there are errors within the resources (e.g. within the ST-code), these errors are not removed in the resources. That means, such errors will be displayed again after a project has been cleaned.

  • Library elements that have been deployed with the setting DEPLOY:=SOURCE (or without the keyword DEPLOY) to a →library are also validated when the project is cleaned. If errors/warnings are reported regarding the library elements of an installed library, the best practice is to contact the library manufacturer to clarify those errors/warnings.

How to clean the project:

  1. In menu Project, select Clean...

  2. In the dialog, select the provided project. Or check Clean all projects to execute the cleaning action for all projects.

  3. Click Clean.

Good to know

Here are the details what "rebuilt from scratch" means in relation to the code for the target system:

The files under the project folders src-gen and target are deleted.
The files under src-gen are recreated based on the resources in the project whereas the files under target are not recreated when the project is cleaned. The files under target are automatically created when the application is built.

The project-internal database is emptied and created anew.
This database is a project index that is used for cross-references, the database is stored in the workspace.

Alternative for finer control over cleaning the source and target files and for avoiding unnecessary deletion of files unrelated to the resources you are currently working on:

  1. Select the project in the view with projects and resources.

  2. In menu Project, select Selective Project Clean…

  3. In the dialog, do the following:

    • Check Clean src-gen (generated sources) to also delete the files under the project folder src-gen for the selected resources.
      If this option is unchecked, just the files under the project folder target are deleted for the selected resources. Also, the project-internal database is emptied and created anew.

    • Check one or more of the listed resources. Or check Select all resources to execute the cleaning action for all resources of the project.

  4. Click Clean.