Compiling delphi package from own program

I'm trying to invoke DCC32 to compile a .dpk file from my own program.
The .dpk file has been written from this program along with a .cfg
file.

However, each time I run DCC32 it comes up with an error: "Fatal:
Required package 'vcl50' not found".

This error only appears if I have the Delphi IDE running. If I close
down Delphi, the exact same program runs and it compiles.

Start up Delphi again, rerun program, same error.

It's though as the vcl50.dcp file has been locked while Delphi is
running and DCC32 tries to access it in a way that conflicts with the
lock, or something like that.

Does it mean that DCC32 cannot be invoked while the Delphi IDE is
running, or is there a trick to this that I'm not aware of? Any help
or tips are welcomed.

Lasse