[DCC Fatal Error] FlexCelXE2.dpk(1): E2225...


I am developing a component with TFlexCelReport and TXLSAdapter in the private section of the class. The following is the code:

  TCustomFlexcelReport = class(TComponent)
    FFlexcelReport  : TFlexCelReport;
    FFlexcelAdapter : TXLSAdapter;
    { Private declarations }

When I try to register the component by building  the relevant .bpl I have the following error message:
[DCC Fatal Error] FlexCelXE2.dpk(1): E2225 Never-build package 'FlexCelXE2' must be recompiled

I opened the file FlexCelXE2.dpk and built it but this doesn't solve the issue.

Where am I doing wrong ?

Many thanks
Pio Pio

Forgot to mention, I have Delphi XE2


This normally means that you have more than one FlexCelXE2.bpl or .dcp in your hard disk, and Delphi is finding the incorrect one (so it wants to recompile it).

Search for any dcus/bpls/dcps that are FlexCel related that might be repeated, and remove them all except the ones installed by the installer.

Normally you might have some files at: c:\Users\Public\Documents\RAD Studio\9.0</div>
but I would suggest to use a tool to search the hard drive (I personally use everything: http://www.voidtools.com )

Once you remove duplicated files, the error should disappear. 

Hi Adrian,

I did the scan of all files FlexCelXE2.* but I didn't find any duplicate. I renamed all files

FlexCelXE2.* except FlexCelXE2.dpk but I still have the same error message.

What else can I try ?

Pio Pio

Did you scan for the dcus and pas?  You should have only one "UExcelAdapter.pas" and one "UExcelAdapter.dcu"  Furthermore only the dcu should be in the search path, not the .pas (if .pas is in the search path, delphi might try to recompile).

If you have no duplicates, the error will go away. I've seen it myself many many times, and it always is a duplicated file somewhere.

But well, the other solution would be to try to recompile FlexCelXE2.dpk to see if Delphi stops trying to recompile it. Or even try to change it from "never build" to "always build", but I wouldn't recommend this because Delphi shouldn't need to rebuild it. If it is trying to rebuild it, then there is some wrong file somewhere.

Basically there were two issues here:
1) The library path had one path that shouldn't had been there
2) There were several copies of the file UExcelAdapter.dcu on the hard drive.

I publish here Adian's detailed solution for everybody's benefit:

1)Uninstall FlexCel 3.9
2)Remove the line C:\Users\admin\Documents\tmssoftware\FlexCelVCL\Source from your library path
3)Reinstall FlexCel 3
4)Look at the library path: There shouldn’t be any FlexCel sources there.
5)Clean the projects where you had UExcelAdapter.dcu. You need to remove not only UExcelAdapter.dcu, but all the other FlexCel dcus. You can just select all dcus in the folder and delete them, Delphi will recreate them as needed.

Now the component is compiled and added to the tool palette correctly.