Archive: Fold UpdateDLL + AddSharedDLL into Files


Fold UpdateDLL + AddSharedDLL into Files
Hi all,
I'm a newbie to NSIS. I was using another installer before. Overall I'm quite pleased with it. I'm still finishing up my new installer but it looks like it will be about 30% smaller than my old one (VISE). It also looks a whole lot nicer. Thanks go out to all that work on this project.

That said, I do find the functionality of the File inscruction a little simplistic. To register a DLL which probably most installs need to do, we have to use a macro (UpgradeDll, which only works on the CVS code, not the latest beta). Wouldn't it be cleaner to have syntax such as this?:


SetOverwrite ifnewerversion ;note: *ifnewerversion*, not ifnewer
File myfile.dll


In my opinion, pretty much every file needs to be replaced even if in use, not just registerable DLLs. I don't want my installer not to upgrade a file just because it's in use. So instead of ever using File I always have to use:

!define UPGRADEDLL_NOREGISTER
!insertmacro UpgradeDLL myfile.exe $INSTDIR\myfile.exe $SYSDIR
!undef UPGRADEDLL_NOREGISTER


That makes the installer grow by chunks for every file since we are including the macro for each file.

Sorry for the long post but it seems like this one change would go a long way for easier/smaller scripts that yield smaller installers.

All the best,
Santiago

By default, the installer gives a warning when a certain file is in use and gives the possibility to retry. That is what most people need for normal applications.

You can also let the installer automatically close your application, so the files won't be in use.

Registering a DLL is possible with the RegDll command. The UpgradeDLL macro does a lot more:

* Compare versions of file / local file
* Upgrade & possible if possible
* Create temporary file if file is in use
* Copy new file on reboot
* Register DLL on reboot

This macro is intented for system DLL files (like runtimes etc.).

The is an UpgradeDLL version available for both beta 3 and beta 4 CVS. You can find it in the 'Useful functions' appendix of the documentation. The latest version in the NSIS Archive requires some of the new beta 4 commands.

The reason why NSIS is so small is that we don't add a command for everything that can also be done with the script language. Using a macro is just as easy as a using normal command.


Hi Joost,
Thank you for taking the time to reply. I know you must be busy with the next version of NSIS.

I didn't realize there was a version of UpgradeDLL for beta 3. I'll look that up.

If the reason for using macros instead of adding it to the language is to keep the installer smaller, then that's fair enough.

Thanks for your time,
Santiago