NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Ignore installed file during update

Wed Aug 24, 2022 11:20 pm

Hi

My initial install places a file 'Launcher.dll' into the folder. This file is then read by a parent 3rd party application. My installed application is an addin. I am running my updater from this Launcher.dll but, because its in use by the parent 3rd party app, i get a notification to close the application first before updating. Obviously when its closed my addin doesnt run and the update is checked. The complete update and install process must occur while the 3rd party is running and the addin is loaded. To remove any doubt, i am invoking a second dll that is called by the addin and loaded dynamically which i can overwrite on the fly without needing to close the 3rd party application

So

How can i handle a file that gets installed on the initial installation but be completely ignored by the installer when an update occurs? If possible, include the file for an actual uninstall.

I thought of the following
1. ignore the file entirely
2. on install, place the file in a different folder and move / copy it after the install (this would work if it could be done)
on uninstall, move the file back so it can be captured by the uninstaller

Thanks

NigelShaw
Posts: 58
Joined: Wed Apr 01, 2015 12:45 am

Re: Ignore installed file during update

Thu Aug 25, 2022 5:26 am

Hey

Managed to figure this out. Here is what i needed to do.

Because Launcher.dll is the file that read by the 3rd party application, it is in use when the application is running.
Because the file is part of the installation, it tries to place it and because its in use, i get a prompt to end the 3rd party application process.

My work around
I moved the Launcher.dll to sub folder for the main installation
I created a vbs file to move the Launcher.dll from the sub folder to the application folder
on the event that the Launcher.dll is in use, it doesnt need to be moved so i added a delete function to the vbs.

in the Installer project, i added a custom Action 'Launch attached file' which will launch a file within the msi but doesnt install it. The attached file is the vbs file. I moved the Custom Action to the end of the Install Execution Stage.

Now when i install and the 3rd party application is running and Launch.dll cannot be overwritten, it just skips it and deletes the one placed in the sub folder.

Its worth noting that the Launcher.dll is a file a created to specifically call a process so it will never require an update.

Here is the vbs script for anyone who needs to do this in the future-

Code: Select all

Option Explicit
Dim fso 

Set fso = CreateObject("Scripting.FileSystemObject")

On Error Resume Next
fso.MoveFile "C:\ProgramData\MyAppLocation\Files\Launcher.dll", "C:\ProgramData\MyAppLocation\"


If fso.FileExists("C:\ProgramData\MyAppLocation\Files\Launcher.dll") Then
    fso.DeleteFile "C:\ProgramData\MyAppLocation\Files\Launcher.dll"
End If
create a text file, copy paste the text above, edit the file name / path as required, save, change the file extension to .vbs


Thanks

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Ignore installed file during update

Fri Aug 26, 2022 11:00 am

Hello Nigel,

Thank you very much for your followup on this and for sharing your solution with us!

I am sure this will be helpful for further users facing a similar scenario.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”