Yes, my question was exactly about that. I need to use that "ugly stuff" before signing. So, in this case I'm afraid I will need to keep my current solution with calling batch file that takes care of the order and has signing as the last step. I'm afraid I don't have enough level of expertise in this area to implement such package on my own.
Anyway, thanks for the response!