Install Delphi Packages Tutorial

This chapter covers the basics of DLL programming from the Delphi point of view. The second part of the chapter will focus on a specific type of dynamic link library: the Delphi package. Packages in Delphi provide a good alternative to plain DLLs, although not so many Delphi programmers take advantage of them outside the realm of component writing. 15.1 Typical scenario for a run time and design time package; 15.2 For Delphians: I can not install a run time package, why not? 15.3 Examples. 16 Platform specific units. 16.1 One unit per platform, several units with same name; 16.2 One unit for only one platform / conditional unit. 17 Different versions of a. If you need to install a third-party Delphi component, and you only have a.PAS source file(s), follow this step-by-step tutorial and learn how to add the component into an existing package. This tutorial covers installing components in Delphi for Win32 (Delphi 7).

Active5 years, 10 months ago

I am preparing an installer (Inno Setup) to install my component package into Delphi XE without having to manually fiddle in the IDE.

How do I install a Delphi component package (for example, MyComponent.bpl) into Delphi without having to manually do it via the 'Install Packages' menu item? Is it a registry key?

David Heffernan
534k36 gold badges877 silver badges1283 bronze badges
Brian FrostBrian Frost
8,19110 gold badges62 silver badges140 bronze badges

1 Answer

Yep, registry is your friend.

Packages:

IIRC Known IDE Packages is for IDE extensions, and Known Packages for components (on the Tool Palette)

Install Delphi Packages Tutorial For Mac

Library paths are in:

Note:

  • <Borcadero> stands for Borland, CodeGear or Embarcadero, depending on your Delphi version.
  • <version> is the IDE version, ie 7.0 for Delphi 2010.
TutorialMarjan Venema

Delphi Package Installer

Marjan Venema
17.8k4 gold badges55 silver badges74 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged delphiinstallcomponents or ask your own question.

Delphi 7 has a main menu option for Component Install Component that guides you through the process of getting a component onto the Palette. Unfortunately, that functionality was lost in the IDE’s transformation to the Borland Developer Studio. I won’t go into details but I was not happy to say the least when I learned of this change.

Regardless, your choices of installing components hasn’t changed it’s just you’re no longer guided through the process. I thought it might be useful to walk through a few scenarios using Delphi 2007. There are many ways to accomplish these tasks so don’t consider this your only option.

Creating and installing a new component into a new Package
Here are the steps necessary to create a new component and get it installed onto the palette though refer to the section below on the caveat with the New VCL Component wizard:

Delphi
  1. Start the IDE
  2. Select File New Package
  3. Select File Save As and give your package the desired name
  4. Select View Project Manager
  5. Right click the package node and select Options then be sure to fill in the Description for this package as it will be used in the Install Packages dialog
  6. Select Component New VCL Component… which will display the New VCL Component Wizard (see note below)
  7. Select TButton as the ancestor and click Next
  8. Leave the defaults for Classname etc. and click Next
  9. Select “Add unit to Package1.bdsproj project”
  10. Select View Project Manager and right click Package1 and select Install

That will get you a new design time package with a new component installed and on your palette. If you have an existing .PAS file that contains a component(s) all you need to do is right click the Contains node under your package and select “Add…”.

Installing an existing component into a new package
The steps here are pretty much the same as above except at step 4 instead of starting the New VCL Component wizard simply open the .PAS file that contains the component(s) and add it to the Contains node of your package.

Installing components into an existing package
In this case, you’ve already created and installed a design time package and you’d like to add a new component.

  1. Select Component Install Packages (Sure, this may seem a bit odd since the package we want is already installed)
  2. Find the desired package and select it in the Design Packages listbox
  3. Click the Edit button which will prompt you to cancel the dialog and open the package as a project
  4. Select View Project Manager
  5. Expand the package node and right click the Contains node under the package and select “Add…” and add your existing .PAS file or select Component New VCL Component and follow the steps above
  6. Right click the package node in the Project Manager and select Compile which will rebuild and reinstall your design time package

Installing existing design time packages
If you have existing component packages and you want to get them on the palette:

  1. Select Component Install Packages
  2. Click the Add button and multi-select the design time packages you want to install then click Ok. You don’t really have to worry too much if the package you select is design time or runtime as the IDE will let you know if there is an issue installing the package.

The issue with the New VCL Component Wizard
There is one rather major flaw with the New VCL Component Wizard and that’s that it places both design-time and runtime code into a single unit. The runtime code is the code that implements the component itself. The design-time code is the Register procedure with the call to RegisterComponents which should be removed and placed in a different unit which belongs it a design time package. In the first scenario above it would be wise to create a second, design-time only package and split the code as described. Additionally, you should mark your packages explicitly as design-time and runtime using Usage Options from the Project Options dialog.

Mixing design-time and runtime code in a single package is a bad idea and needs to be avoided. Design-time code isn’t necessary at runtime and typically contains property and/or component editors along with various registration calls which are only meaningful when the package is installed in the IDE.

Let me know if this was helpful and if you’ve been impacted by the removal of Component Install Component functionality. I’ve already discussed it with Nick Hodges.

[UPDATE: May 9, 2007] Also see Creating Packages from the Delphi wiki.