Project organization with submodules and referenced project

9 vues (au cours des 30 derniers jours)
Claudio Rosso
Claudio Rosso le 7 Juil 2025
Réponse apportée : Sameer le 10 Juil 2025
Good afternoon,
I'm trying to organize my project with atomic approach using submodules.
My architecture is the following:
I have two generic libraries Called A and B, A is referenced into B and B is referenced in any other library or project. I also have different device libraries, called C,D and E that referennce both A and B In the end I have the main application that reference A, B, C, D and E.
Using submodules and references, when i try to open the main application, the IDE will try to open a big number of different versions of A and B libraries.
My question is: there is a better way to share libraries into projects without creating this kind of opening chain? I want to be sure that the library A and B used by artifacts into any project are the same, to avoid models or library blocks that differ from one device library and another or the main application
Best regards.
Claudi0

Réponses (1)

Sameer
Sameer le 10 Juil 2025
To avoid multiple versions of libraries A and B being loaded when opening your main application, it’s best to organize them as separate Simulink projects and use project references in all dependent libraries (C, D, E) and the main app. This way, all components refer to the same instance of A and B, avoiding duplication and version mismatches.
Here’s a suggested structure:
  • Create individual projects for A and B, each with its own .prj file.
  • In libraries C, D, E, and the main application, add A and B as referenced projects (via Project > New Reference).
  • Avoid maintaining local copies of A and B inside device libraries to prevent conflicts.
If you're using Git, you can manage A and B as submodules, which helps lock their versions and keep them consistent across teams and branches. Just clone them into a fixed location and point your references accordingly.
This setup keeps your architecture clean, ensures version consistency across all libraries, and prevents the IDE from opening multiple versions of the same library.
Hope this helps!

Catégories

En savoir plus sur Dependency Analysis dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by