简体   繁体   English

创建安装程序时如何从设计时程序包内确保正确的“需要” Delphi运行时程序包定义

[英]How to ensure correct 'requires' definition of a Delphi run-time package from within a design-time package when creating an installer

I am creating an installer for components that currently do not have one (for example the excellent SynEdit editor library), this has also allowed me to get to understand design and run-time packages better than I did. 我正在为当前没有组件的组件创建安装程序(例如出色的SynEdit编辑器库),这也使我比以前更好地了解设计和运行时软件包。

I want to ensure the cleanest deployement, so I understand that many units will go into a runtime package, and in time I may deploy using 'build with runtime packages' so that's all good. 我想确保最干净的部署,所以我知道很多单元都将放入运行时包中,并且随着时间的流逝,我可能会使用“使用运行时包构建”来进行部署,这一切都很好。 Often though, the design-time package requires the runtime package and this is where I'm getting into trouble. 但是,设计时程序包通常需要运行时程序包,而这正是我遇到麻烦的地方。 Typically I create a project group which has the runtime package project (xxx-RXE) followed by the design-time package project (xxx-DXE). 通常,我创建一个项目组,其中包含运行时程序包项目(xxx-RXE),然后是设计时程序包项目(xxx-DXE)。 Do a build all and everything is fine. 进行全部构建,一切都很好。 I deploy both packages in BPL, DCP and DCU form within a library path of my own and install the design-time package into the IDE using the registry . 我在自己的库路径中以BPL,DCP和DCU形式部署了这两个软件包,然后使用注册表将设计时软件包安装到IDE中 The library path is then added to the environment settings. 然后将库路径添加到环境设置中。 When I open Delphi (this is true for D7 as well as XE) I get 'Cannot load package XXXX-DXE, library package xxx-RXE.bpl not found. 当我打开Delphi时(D7和XE都是如此),我得到'无法加载软件包XXXX-DXE,找不到库软件包xxx-RXE.bpl。 If I cheat by modifying the design-time package to remove xxx-RXE.dcp from 'requires' and replace this with the units directly, all is fine. 如果我通过修改设计时程序包作弊以从“ requires”中删除xxx-RXE.dcp并将其直接替换为单位,那么一切都很好。

I am trying to avoid poking anything into Delphi folders, so my project structure is like this (only XE is shown, D7 is similar). 我试图避免将任何东西放入Delphi文件夹中,所以我的项目结构是这样的(仅显示XE,D7相似)。 The packages are set to output units, bpl and dcp to "..\\Library\\Delphi15", all packages are given a search path of "..\\Source" and the design time package an additional search path of "..\\Library\\Delphi15" (to find the runtime package it requires). 软件包设置为输出单位,bpl和dcp设置为“ .. \\ Library \\ Delphi15”,所有软件包的搜索路径为“ .. \\ Source”,设计时软件包的附加搜索路径为“ .. \\ Library”。 \\ Delphi15“(查找所需的运行时程序包)。

\Root
  \Packages
    xxx.groupproj
    xxx-RXE.dpk
    xxx-DXE.dpk 
  \Library
    \Delphi15
      (output of all dcus, dcp's, bpl's etc. Manually added *.res, *.inc and *.dfm's).     
  \Source
    (The original project source files as used by the packages).

None of the above folders are used by Delphi, I dont do anything with the Delphi IDE until my installer has created the following deployment folder: 上面的文件夹都没有被Delphi使用,在我的安装程序创建了以下部署文件夹之前,我不会对Delphi IDE进行任何操作:

c:\Program Files\xxx\Library\Delphi15

(contains all BPL's, DCP's, DCU's etc etc, that is also the path put into the environment library path). (包含所有BPL,DCP,DCU等,这也是放入环境库路径的路径)。

So what I'm not clear about is that if all of the files are in that folder with a path to it, why cant delphi see them? 因此,我不清楚的是,如果所有文件都在该文件夹中并带有路径,为什么delphi无法看到它们?

Thanks for any help. 谢谢你的帮助。

Just reading "Cannot load package XXXX-DXE, library package xxx-RXE.bpl not found" triggered bad memories. 只是阅读“无法加载程序包XXXX-DXE,未找到库程序包xxx-RXE.bpl”,就会触发不良记忆。 Usually I got this error when the path containing the DCP (and/or BPL?) is not contained in the Windows environment variable PATH. Windows环境变量PATH中不包含包含DCP(和/或BPL?)的路径时,通常会出现此错误。

When an installed package references another package then the normal "Windows library search behavior" for this referenced package kicks an (on Delphi startup). 当已安装的程序包引用另一个程序包时,此引用程序包的常规“ Windows库搜索行为”将触发(在Delphi启动时)。 No Delphi path configurations are active at this time . 目前没有任何Delphi路径配置处于活动状态 Thus your installer needs to modify the PATH env variable as well (or copy the file some place already contained). 因此,您的安装程序还需要修改PATH env变量(或将文件复制到已经包含的位置)。

I'm pretty sure that the DCP has to be in Delphi's DCP folder. 我非常确定DCP必须位于Delphi的DCP文件夹中。 On my machine with Delphi 2010 and Windows 7, it's in C:\\Users\\Public\\Documents\\Rad Studio\\7.0\\Dcp . 在装有Delphi 2010和Windows 7的计算机上,它位于C:\\Users\\Public\\Documents\\Rad Studio\\7.0\\Dcp

Searching around the registry, this path is found in HKCU\\Software\\Codegear\\BDS\\7.0\\Library under the value Package DCP Output . 在注册表中搜索时,可以在HKCU\\Software\\Codegear\\BDS\\7.0\\LibraryPackage DCP Output值下找到此路径。 Of course you'll have to expand the string, because it's in there as $(BDSCOMMONDIR)\\Dcp . 当然,您必须扩展字符串,因为它以$(BDSCOMMONDIR)\\Dcp存在。

I would also put the runtime BPL in the Delphi default location as well, which again (for me) is C:\\Users\\Public\\Documents\\Rad Studio\\7.0\\Dcp . 我还将运行时BPL也放在Delphi的默认位置,对我来说,它也是C:\\Users\\Public\\Documents\\Rad Studio\\7.0\\Dcp

"library package xxx-RXE.bpl not found" might be misleading. “找不到库软件包xxx-RXE.bpl”可能会引起误解。 I believe it in fact means LoadPackage failed, for some reason. 我认为这实际上意味着LoadPackage由于某种原因而失败。 This might be caused by a dependent package not present in Windows path. 这可能是由Windows路径中不存在的从属程序包引起的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM