I'm working on an installer that uses a standard DLL to determine the path of APPDIR bases on the location where the user is installing our application. The DLL checks the user's ip address to determine if the installation is being performed in our offices or our outside of our company network.
For an office setting, I want the installer use a predetermined location on the computer. However for all other situations, it uses a location in the user's AppData folder instead. So far the DLL is integrated into the install and works well. The issue I'm having is in determining when I can change APPDIR.
The DLL has an exported function that performs the ip address check and returns a folder path as a string. The DLL is also added as a temporary file.
I created 2 custom actions. The first calls the exported function in the DLL that returns the target path which I assign to a user property.
The second custom action. Sets the APPDIR property to the user property from the first action.
I've been having trouble determining when APPDIR should be set.
The sequence for the Install Stage is as follows (my custom actions are in bold)
Searches
Paths Resolution
Preparing
RemoveExistingProducts
Remove Resources
Call Function From DLL ( calls DLL function to get path and sets user property with return value )
SetProperty ( sets APPDIR to user property from above)
Add Resources
Finish Execution
What I end up with is the application executable installing to the default path I set for APPDIR in the project. However I also import values into an INI file which is also installed to APPDIR. But I see that INI file gets copied to the path I return from the DLL. In other words, the executable always gets copied to the hardcoded APPDIR value in the project but the INI file is copied to the path returned from the DLL function call.
It seems like that the program executable is copied before APPDIR is changed, but the INI file is copied (imported) after the value is changed.
if I move the 2 custom actions earlier, I get an error that the DLL can't be found. Again the DLL is a temporary file.
Also note that this is a minimal user interface. No dialogs. Just the progress bar displayed.
Any ideas on what is the best to accomplish the task of setting APPDIR from a DLL function call?