11-09-2020 01:58 PM
I have a solution with two packages, one containing folders and files, the other containing just a couple files.
I want a *.BAT file to run before my uninstall happens, so have created a "pre-uninstall" entry with this BAT file. I have this BAT file inside my package files.
If I include this BAT file in my package with the bulk of the files, what happens during the uninstall process is that all the files are deleted (including the BAT file) before my BAT file runs, then the BAT file tries to run, but unfortunately doesn't exist and I see an error.
If I include the BAT file in the small package with just a couple files, it runs as expected!
Help!
11-10-2020 10:16 AM
Julia, If you have a dependency between the two packages, I would expect that the dependent package to be uninstalled first and so its pre-uninstall to run first, and then the dependent package will be uninstalled last. If no dependency is defined, then there can be no guarantee on uninstall order.
11-11-2020 10:11 AM
I do have a dependency set up, but it doesn't seem to work that way 😞
Also, the biggest problem is that I have a BAT file in the pre-uninstall section that cannot run because the uninstaller deletes the files before the uninstaller runs the BAT file, which doesn't make sense to me, as I thought "pre-uninstall" would mean "before the uninstall happens".
11-14-2020 02:05 AM
Julia -
If the custom execute that you are using is not waiting for call to complete, or if the the BAT file itself is running EXE commands without using START the package uninstall could continue before the deletes occur.
Questions:
1) How are you building the packages?
2) What options are you using with custom execute? If (1) is nipkg.exe, please share what your instructions file looks like, if NI Package Builder, please share what your settings are in the configuration dialog, otherwise, please share similar information.
2) What does your BAT file look like syntactically where it does the delete?
3) Is it a single BAT file, or multiple BAT files calling each other? If multiple, what is your syntax?
I mostly use NI Package Builder and this is a nice topic for it: https://www.ni.com/documentation/en/ni-package-builder/20.5/manual/customexecutes/ Note in the topic that using the cmd.exe /k argument instead of /c is very useful to pause the BAT file before exiting to see the console and to verify that the uninstall operation is truely waiting for the BAT file to complete.