From Xojo Documentation
Normally your projects are independent of each other. But there are certainly times when you may have common project items that you want to share amongst multiple projects.
Copy and Paste with a Master Project
The simplest way to do this is with copy and paste. You can select the project items in the Navigator, copy them and then paste them into another project. This creates two separate copies of the project items for each project. The best way to use this technique is with a “master project” that contains the shared code you use. Keep the master project updated with all your shared code and any changes you make.
You can copy shared project items from the master project as needed to your other projects. This technique allows you to re-use project items without having to worry about changes affecting other projects.
Export / Import Items
You can also use the File Export and Import items to create standalone files on disk that can be used to share with others and with other projects. Project Items can be exported as Binary or XML format. To export a project item, select it in the Navigator and then choose File ↠ Export from the menu. You'll be prompted for a location.
To import a project item that was previously exported, choose File ↠ Import from the menu.
You can also convert project items to “External Project Items”. An External Project Item can appear in multiple projects, so changing the shared project item in one project changes it for all projects that use it. When you create an External Project Item, the item becomes a file on disk (in either Binary or XML format).
To convert a normal project item to an External Project Item, open the contextual menu for the item in the Navigator (usually by right-clicking on it) and select “Make External".
This prompts you to choose a location and type for the file. Your choices are Binary or XML. If your External Project Item is going to be stored in a source control system, XML is the better choice. External Project Items appear in the Navigator as italic with a small arrow icon superimposed on the normal icon.
Once an you have a project item saved as a file on disk you can add it to another project as an external item. To do so, hold down the Alt key (⌘+Option on Mac) before clicking in the menu, then select the File menu and you'll see the Import item now says "Import External". Choose that command and select the file to be imported.
You can also add an external item by dragging the file from the disk to the Navigator while holding down ⌘+Option (on Mac) or Shift+Ctrl (on Windows and Linux).
Files that were created using the standard "export" process can also be added as external using the above steps.
|If you make a change to an external project item outside of Xojo (perhaps with source control), the change is not automatically reflected in any open projects that are using the external project item. You have to close and reopen the open projects in order to see the change.|
For additional information, refer to these topics:
- User Guide: Project Types
- Video: Code Sharing