Delphi Install Dpk Package
In this tip I draw together in one place information on how to install components into the Delphi IDE for various Win32 versions of Delphi. The notes also cover how to install IDE extensions or make simple units available in design time packages. The tip assumes you are installing source code, not pre-compiled units or packages.
Before you start copy all the files needed to install the component, IDE extension or unit into some suitable location on your hard disk. Files should include .pas
files and any associated .dfm
, .res
, .dfm
and, for components, .dcr
files.
You then proceed differently for different versions of Delphi:
Installation with Delphi 2005 and later
Installation with Delphi 3 to 7 Open the required package. Select File Open menu, make sure that files with. The package editor will now be displayed. If its Install button is not disabled then click it. Now click the package editor's Add button. The 'Add' dialogue box will be displayed.
To add a component or IDE extension to the IDE it must be included in a design package. You can either create a new design package or add the component to an existing one. These instructions assume you will be installing into an existing package. See the Delphi help for information on how to create a new package. If your component came with its own package, use that.
- Open the required package. Select File Open menu and choose a suitable package source file (
.dpk
extension. You may decide to install into the 'user' package that is often supplied with Delphi. - The selected package (with
.bpl
extension) will now be displayed in the Project Manager. If the package has not been installed yet right click the.bpl
entry in the Project Manager and select Install. Dismiss any resulting message dialogue. Now right click the
.bpl
entry again and select Add. What happens next depends on the version of Delphi.- For Delphi 2009 and earlier the 'Add' dialogue box will be displayed. Click the dialogue's Browse button then select the
.pas
file(s) to be installed from the resulting file open dialogue. The full path to the file(s) should now be displayed in the 'Add' dialogue's Unit file name edit box. Click OK to add the file(s) to the package. - For Delphi 2010 and later a simple file dialogue box will open from where you can choose the required
.pas
file(s). Just press OK to add the file(s) to the package.
- For Delphi 2009 and earlier the 'Add' dialogue box will be displayed. Click the dialogue's Browse button then select the
- Back in the Project Manager, check that the
.pas
file(s) you added appear under the package's 'Contains' node. Also check that any associated.dcr
files also appear. If any.dcr
file does not appear you need to display the package's source file and add the line {$R FileName.dcr} to the code between the package name and the requires section. To display the source right click the package name in the project manager and select View Source. - If you are installing an IDE enhancement, like a property editor, make sure the
designide
package is included in the package's requires section. - Now right click the
.bpl
entry again and select Compile. If no errors are displayed the package has been recompiled correctly. When adding components the package may need to be (re)installed. Right click the
.bpl
entry again and select Install. If all goes well a message should be displayed indicating that the component has been registered and it will appear in the appropriate tab of the Tool Palette (which will be named 'DelphiDabbler' when installing one of the components from the DelphiDabbler Code Library).Should a message appear saying that the installation has failed you will need to un-install the package and try again. How this is done depends on the version of Delphi.
- In Delphi 2009 and earlier select the Components Install Packages menu option then select the required package in the resulting dialogue box. Press the Remove button followed by OK. The package will now be uninstalled.
- In Delphi 2010 and later the
.bpl
entry's context menu has an Uninstall option. Simply click that option to uninstall the package.
- Close the package project using the File Close menu item. Accept any prompts to save the package project.
- If you wish you can now delete the
.pas
file. Other files must be left in place.
Building for 64 bit Windows (Delphi XE2 and later)
If the components etc. The legend of the fallen kingdom 1 codes. are compatible with 64 bit Windows add to a package as described above. Now add a Windows 64 bit target to the package project and rebuild.
Installation with Delphi 3 to 7
To add a component or IDE extenstion to the IDE it must be included in a design package. You can either create a new design package or add the component to an existing one. These instructions assume you will be installing into an existing package. See the Delphi help for information on how to create a new package. If your component came with its own package, use that.
- Open the required package. Select File Open menu, make sure that files with the
*.dpk
extenstion are being displayed, and choose a suitable package source file. You may decide to install into the 'user' package. This is found in theLib
sub-directory of your Delphi installation and is nameddclusr.dpk
ordclusrXX.dpk
whereXX
is a version number. - The package editor will now be displayed. If its Install button is not disabled then click it to ensure the package is installed into Delphi. Dismiss any resulting message dialogue.
- Now click the package editor's Add button. The 'Add' dialogue box will be displayed. Click the dialogue's Browse button then select the required
.pas
file(s) from the resulting file open dialogue. The full path to the file should now be displayed in the 'Add' dialogue's Unit file name edit box. Click OK to add the file(s) to the package. - Click the package editor's Compile button. The package will now be recompiled and, if no errors are displayed, the package has been recompiled correctly. When adding components a message may be displayed at this stage indicating that the component has been registered. In some cases it is necessary to click the Install button after compiling before the component will be registered and the message displayed. Any components will now appear appropriate tab of the Tool Palette (which will be named 'DelphiDabbler' when installing one of the components from the DelphiDabbler Code Library).
- Now close the package editor window. You will probably be prompted to save the package. Agree to this and the package source file will be updated with information about the new component.
- If you wish you can now delete the
.pas
file. Other files must be left in place.
Installation with Delphi 2
- Select the Component Install menu option to display the 'Install Components' dialogue box.
- Click the Add button to display the 'Add Module' dialogue box.
- Click the Browse button and choose the required
.pas
file from the resulting standard file open dialogue box and click Open. - This returns you to the 'Install Components' dialogue box. Click OK here to rebuild the component library. If you were installing component it should now appear on the component palette (which will be named 'DelphiDabbler' when installing one of the components from the DelphiDabbler Code Library).
- If you wish you can now delete the
.pas
file. Other files must be left in place.
Author: | Peter Johnson |
---|---|
Added: | 2009-10-06 |
Last updated: | 2010-02-22 |
- ..
- 106
- ..
« Return to contents »
Installing components under Delphi XE3 is a nightmare. First I need to add source files to Tools - Options - Library. then I need to find a normal package and compile it. finally I need to find design time package and install it. This is just quite tedious and error prone. Is there a nicer way to install components?
A package source file should be saved with the.dpk (Delphi package) extension to avoid confusion with other files containing Del source code. To open a package source file in the Code editor, 1 Open the package in the Package editor.
I have found. Unfortunately it doesn't support Delphi XE3 or above. I have heard that there is something similar which produces exe packages that install themselves (something like Inno Setup) but I can't find such thing. The steps above are required. First, adding the file path to Tools-Options-Delphi Options-Library Path is so the compiler knows where to find the files to compile them. (Actually, it's not required - you can eliminate this step by making sure that the.dpk files are in the same folder as the.pas files, and that all.pas file names are listed in the includes section in the.dpk. If the.pas files are in a different location, you'll need to either use relative paths in the.dpk (eg., MyComponents in '.
Source MyComponents.pas') or add the location of the.pas files to Project-Options-Delphi Compiler-Search Path.) The next step (finding the 'normal package') is in order to build the runtime package. It's required, because the design-time package (next step) requires the code that's in that package in order to function in the Form Designer. It's also needed when you decide to build your application with runtime packages, if you use the third-party components and want to distribute the runtime package for it. The separate design-time package (the third step) is required because designtime code can only be used at design-time; there's nothing that can be distributed with an application if it's built with runtime packages and the package build in step 2 is one of them. This has been the way components are installed since around Delphi 3 or so, and the requirement to separate out designtime code into it's own package started being advised in Delphi 5 and enforced in Delphi 6 (when they relocated much of the IDE designtime support into their own separate packages and stopped distributing the source for them). There really are no other options, unless the vendor supplies pre-build designtime and runtime packages for you, or supplies an installer that will do all of the above steps.
(Most don't.) But if you update your Delphi version, you'd still have to go through the steps above. I would say that the best way to install components is to use your build manager (for example FinalBuilder) and add each component to a manager-project file which sets the necessary paths, builds the DPK files, and 'installs' the component in the IDE by making a registry entry.
Delphi Install Dpk Package In Pakistan
That way you have a documented procedure which allows you reliably to set up or repair your complete, tested, Delphi development environment. You can simply re-run the project when a component has been updated and tested.
It is also quite easy to tweak an existing project to handle a new Delphi version. The big disadvantage of a vendor-supplied installer is that all the ones I have seen simply overwrite the previous version on updates.
I prefer to control the install myself, so that I have previous component source versions archived and available for comparison, in case testing reveals a problem with an upgrade. The 'one-click install' sounds fine, until a minor component upgrade suddenly causes your application to stop working.
. Installing TMS components with shared units Background Several TMS Components share units. Two such examples are: ADVSTYLEIF.PAS and ADVGDIP.PAS. These units define commonly used functionality, classes, constants etc.
It is a known limitation of the Delphi packages architecture that for installed packages in the IDE, a unit can only be present in one package. As such, it is problematic to install two or more packages that use the same unit(s). It is not desirable at all from our development perspective and not from a deployment perspective to duplicate the code in units with different names.
Not only causes this issues when common constants, classes need to be used, but duplicating code is never a good idea. When multiple packages were purchased that have shared units, fortunatily as we deliver all products with full source code, it is straightforward to overcome this. When purchasing product bundles like this problem also does not occur. TMS Component Pack packages are designed & optimized to allow to use all components simultanously. Although it is more convenient to install & use a product like we did not want to remove the flexibility & freedom of customers to choose just some specific components instead of a bundle.
Step by step solution guide. Create a new folder. Move the shared unit(s) from the different product folders to the new folder (for example ADVSTYLEIF.PAS, ADVGDIP.PAS.). Open the package files of the different products and remove references to the shared unit(s) (for example ADVSTYLEIF.PAS, ADVGDIP.PAS.).
In the new folder, create a new package file: TMSCOMMON.DPK. Add the shared units to this new package file and compile & install this package TMSCOMMON.DPK. Open the package files of the different products and in the Requires list of the package, add a reference to TMSCOMMON.DCP. Compile & install the packages of the different products Now all products using the shared units will be installed. Example to illustrate the process When trying to install TAdvStringGrid and THTMListBox simultanously, the IDE will complain about shared units ADVSTYLEIF.PAS and ADVGRADIENT.PAS.
To install both components simultanously in Delphi 2010 we perform following steps: 1) Create new folder C: Users UserName tmssoftware TMSCommon, further referred to as ($CMN). 2) Move the files ADVSTYLEIF.PAS & ADVGRADIENT.PAS from the TAdvStringGrid folder to this ($CMN) folder. 3) Delete the files ADVSTYLEIF.PAS & ADVGRADIENT.PAS in the THTMListBox install folder.