RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++

Classic Tip: From Default Project Options to RAD Studio Option Sets

In early versions of Delphi and RAD Studio, a user could change some of the current project options and (with a check box) save them as default, that is as the initial options for any future project. It was also possible to change this configuration by selecting the Project Options when no project was active. This feature is long gone (I think it was dropped from XE2 or XE3).

What’s the alternative? It is called option sets and it is way more powerful that the default project options. YOu can read about it in the RAD Studio Doc Wiki at http://docwiki.embarcadero.com/RADStudio/Rio/en/Option_Sets_Overview. Here are some notes from my “Delphi 2009 Handbook” adapted to 10.3 Rio and with new images.


In the Project Manager you can select a build configuration and export its settings to an “option set” file. This is like saving a configuration template or skeleton to an external file, and the configuration will be linked to the file. You can create a new option set starting from the Project Options dialog (save) or apply an existing set:

This makes it easy to move those same settings to a new or another existing project, as you can use the Project Manager (using the Apply Options Set local menu item while on a build configuration) or the Project Options dialog box (using the Apply Options button) to import a set of configuration options. In both cases Delphi opens up the Apply Option Set dialog box, in which you can pick a file and choose whether to keep the external configuration file linked (so that a change in the file will be reflected in the projects using it) or simply merge the current settings using some priority rules.

Once you have created an external option set on a file, you can edit it from any project referring to it, using the Edit local menu of the Project Manager pane:

This opens up the an editor containing a subset of the pages of the Project Options dialog box, as shown below:

The .OPTSET file is an XML file with a format similar to the .DPROJ format, again based on the MSBUILD XML format, and an OptionSet project type. This is a simple example of its contents:


While this is an old feature, I’m pretty sure a few of the RAD Studio and Delphi users might have missed it. Notice that having multiple proejcts with settings linked to the same option set allows you to edit the configuration of many projects at once, and still override the default in each individual project as needed.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Learn More About Upgrading

About author

Marco is one of the RAD Studio Product Managers, focused on Delphi. He's the best selling author of over 20 books on Delphi.
Related posts
RAD StudioTech Partner

Powerful Live Local And Remote Application Logging With CodeSite Express In Delphi

C++News

Using Python4Delphi with C++Builder (webinar)

C++Delphi

Ultimate Compression Toolkit For Delphi And C++ Builder Developers

C++DelphiRAD Studio

Beautiful Responsive Home Screen UI Templates For FireMonkey Available For Free Via GetIt In The IDE

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES