Video Screencast Help
Protect Your POS Environment Against Retail Data Breaches. Learn More.

Error in custom action....

Created: 02 Sep 2010 • Updated: 02 Sep 2010 | 5 comments

Hello,
struggling with a, as it seems, sequencing problem. I have a dll with two functions, BackupUserFiles and RestoreUserFiles. I placed the BackupUserFiles call right before RemoveExistingProducts, which in turn is before InstallInitialize in Execute immediate.  The call is made with a "Call custom dll from installation". That works without problems. Also, if i place the RestoreUserFiles call right after the backup call, that one also works perfectly. But i want to do the RestoreUserFiles after the previous product has been uninstalled, after RemoveExistingProducts somewhere. I have fiddled around with the call to RestoreUserFiles but always get a error message "Error in custom action. The library ... WiseCustomCalla22.dll is invalid or could not be found". I guess thats the temporary dll file unpacked from the binary table that doesnt exist at anytime.

I would have assumed that i could palce the call after installFinalize, for all immediate actions to have been executed, but that one doesnt work either. I have also tried to place the call in the Execute deferred sequence, but the same error. So im confused, why this problem to call this dll after RemoveExistingProducts? isn't it installed again at some point, temporarily in the system?

Regards /Mikael

Comments 5 CommentsJump to latest comment

EdT's picture

How about creating separate DLLs for the two functions?  Then at least you can establish whether the problem has any connection with sequencing, or is due to the DLL having a coding error.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

mibswed's picture

The dll have no coding problem, as when i place the call to RestoreUserFiles immediatelly after BackupUserFiles, then it works fine. but, as soon as i call RestoreuserFiles after RemoveExistingProducts, then it doesnt work anymore "Error in custom action. The library ... WiseCustomCalla22.dll is invalid or could not be found". Shouldn't a dll in a "Call custom dll from installation" always be unpacked to a temporary one and executed by the installer?

EdT's picture

I hope you can understand that it is extremely difficult to diagnose these sorts of problems via a forum discussion. Whereas I understand your contention that the DLL has no coding problem, the fact is that your DLL is not working as you require, so we can either debate the situation further or we can try something that may solve the problem.
By providing two separate DLLs, each call will result in a different DLL being unpacked from the MSI and should therefore overcome any issues caused by DLLs not being unloaded correctly. I don't know exactly how DLL loading and unloading is managed by Windows Installer, so in the absence of a full debugging environment, this would appear to be the simplest and quickest way to proceed.  
Or you could try microsoft.public.platformsdk.msi - this newsgroup often has Microsoft techies visit, so they may be able to offer more direct solutions.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

mibswed's picture

EdT, Of course i'm not expecting a diagnose and solution right away. I'm a developer (forced into Wise useage also) and i know its a lot of information needed to often solve a problem. But, i was only hoping for anyone having had a similar problem and any suggestions so i can proceed. I have tried your suggestion to split it up in two dll:s but same problem, and, as said previously i have a hard time thinking this is a problem, as when i do the call before RemoveExistingProducts, then it works (dont then think its a coding problem in the dll?).
Perhaps its a problem that i try to recreate a folder that was uninstalled by RemoveExistingProducts? I dont know. But, thank you for your suggestions and hoping to find the problem...

EdT's picture

OK, go back to your original DLL, but place it in the system32 folder on your test system. Then change the custom action call to "Call Custom DLL from Destination".
This will test the DLL functionality with your desired sequencing and take out of the equation any unpacking issues caused by having the DLL in the binary table.

If that works, then at least some progress will have been made....

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.