The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,152 other subscribers

Delphi design-time packages: “%1 is not a valid Win32 application”

Posted by jpluimers on 2021/12/22

For my link archive, as I hardly see this (it happens in many Delphi versions and always has to do with missing/wrong DLLs), so always forget how to solve it.

Basically it is the same fix as for Fixing hg.exe “ImportError: DLL load failed: %1 is not a valid Win32 application.”:

If you get the below error when running hg.exe, then you are mixing a 64-bit Mercurial with 32-bit dependencies.

[Wayback] XE2 – “%1 is not a valid Win32 application” when installing a package – embarcadero.delphi.ide with entries by [Wayback] Remy Lebeau and [Wayback] Jeff Overcash:

I don't know what I did, but when trying to install a set of freshly built 
Delphi Win32 packages into the IDE, XE2 is giving me this error message now:

Can't load package ...
%1 is not a valid Win32 application.


> Often that is caused by the same named 32 and 64 bit run time packages
> and the OS finding the 64 bit first when the IDE must load the 32 bit.  If
> that is the case check your path variable and make sure the 32 bit paths
> appear first.

That was the problem.  The Windows PATH variable had a 64-bit folder in front 
of the 32-bit folder.  Deleted the 64-bit files and the error went away. 
 Noe I'm getting a new error:

The program can't start because <RuntimePackage>.bpl is missing from
your computer. Try reinstalling the program to fix this problem.

But the "missing" package is in the same folder as the design-time package 
I am trying to install.

Since the design time location is known it is explicitely 
loaded, but the run time is implicitly loaded and follows the dll loading rules. 
  Both are dynamically loaded.

The reason you only see this the next time you restart the IDE is because the 
working directory changes to your project directory when you load a project so 
if the runtime is there it is found that way, but the next time you load the IDE 
the working directory starts in the bin directory.

I thought it was, but turns out the 32-bit output folder had been moved and 
the PATH was not updated accordingly.  Fixed the PATH and now the packages 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: