Home > Back-end >  How to deploy custom bpl with a datamodule unit?
How to deploy custom bpl with a datamodule unit?

Time:11-18

I have a group project:

  • PkagDemmo.exe(main application)
  • AppAddin.bpl(load/unload bpl and create Form utilities)
  • PkgData.bpl(DataModeule unit for Data access utilities)
  • Pakage1.bpl(Form1 bpl and show data)
  • Pakage2.bpl(Form2 bpl and show data) PakDemo.exe Project Options:
  • Packages/Runtime Packages/ Link with runtime Package = true
  • Packages/Runtime Packages/ Runtime packages = true

On my developed PC, the application runs well,but moving those 5 files to my notebook,run the PkageDemo.exe will rise the Error: can not found: FireDACCommonDriver270.Bpl, FireDACComnon270.Bpl,FireDACCommonODBC270.Bpl,vclFireDac270.Bpl......... those are PkgData.bpl DataMoudles uses FireDacXXXX units, DB units require dynamic bpls. I copy those bpls to my notebook, but it still shows an Error. Why application can not find those FireDacxxx.bpl, and how to solve this problem? //Delphi 10.4.2 Win10

CodePudding user response:

Standart rule of finding files by application:

  1. It's try to find in current work folder (if you use link it's field "work directory" of link, if you run by doubleclicking in explorer - current folder)
  2. It's try to find file by parsing string in "Path" enviroment variable. It's take folders one by one, splited by ";" symbol.

If application does not find file by those rules - you will get error message. So to solve your problem you can - place all files in same folder or modify "path" variable to add folders with all your bpls or use absolute path to files (if you load it manualy in runtime).

It's works on your DeveloperPC becouse Delphi add folders with runtime bpls in "path" variable.

Added later:

About "path" - It's a system environment variable, so it's depend from version of Windows how to open it. If you use Widnows 10 or 11 just go to settings and type "enviroment" in "find box" - windows will show show editing window. But it's will not help until you find all necessary bpls.

Main problem that you must put not only bpls that your application and your bpls using directly, but also bpls that FireDac bpls is using.

Easiest way to find them all - use some program that can find dll/exe/pbl dependancies. I use "File info plugin" for TotalCommander, but you can google some other programs for same action.

Other way much longer, but don't need any additinal programs. You try to run your application, see error message like "The code execution cannot proceed because KComponents.bpl was not found. ....". Then find this "KComponents.bpl" on Develop PC (first look at something like "c:\Program Files (x86)\Embarcadero\Studio\21.0\Redist\win32"), copy to notebook at same folder with EXE file of your application and try to run it again. You will see next BPL that is missing. And so on, so on.

Here is a dependency tree for all BPLs that you write in question:

FireDACCommonODBC270.bpl
    rtl270.bpl
    dbrtl270.bpl
        rtl270.bpl - duplicate
    FireDACCommon270.bpl
        xmlrtl270.bpl
        rtl270.bpl - duplicate
        dbrtl270.bpl - duplicate
    FireDACCommonDriver270.bpl
        rtl270.bpl - duplicate
        dbrtl270.bpl - duplicate
        FireDACCommon270.bpl - duplicate
        
vclFireDAC270.bpl
    rtl270.bpl
    dbrtl270.bpl
    vclwinx270.bpl
        vcl270.bpl
            rtl270.bpl - duplicate
        vclimg.270.bpl
            rtl270.bpl - duplicate
            vcl270.bpl - duplicate
        rtl270.bpl - duplicate
        bindengine270.bpl
            rtl270.bpl - duplicate
    FireDACCommon270.bpl - duplicate
    FireDAC270.bpl
        rtl270.bpl - duplicate
        dbrtl270.bpl - duplicate
        FireDACCommonDriver270.bpl - duplicate
        FireDACCommon270.bpl - duplicate
    vclx270.bpl
        rtl270.bpl - duplicate
        vcl270.bpl - duplicate
    vcldb270.bpl
        rtl270.bpl - duplicate
        vcl270.bpl - duplicate
        vclwinx270.bpl - duplicate
        dbrtl270.bpl - duplicate
        vclwinx270.bpl - duplicate
    vcl270.bpl - duplicate
  • Related