Skip to content
⌘ NSIS Forum Archive

Best practices for script design: ProgramFiles and user files

3 posts

jlh@sfs#

Best practices for script design: ProgramFiles and user files

I'm developing my first installation package with NSIS. The application UI is developed in C# in VS2017 on Windows 10 and the install package was originally developed with Windows Installer. Because of limitations with Windows Installer, the user had to perform functions I wanted to handle in installation and I think I can do that with NSIS. I wish to install the application per computer with the program files placed in the current Program Files directory and user specific input/output data in the current user's Documents directory. Uninstall is to be provided for the program files but not for the data files. Once the installation is done for the first user with administrator rights, other users could install their own input/output data files, preferably with standard rights. First of all, I would welcome advice on whether this is a reasonable design plan and, secondly, I'm wondering how the script should be laid out to do this. Can it all be handled in a single script or is it necessary to develop separate scripts for the program files and the data files, which could then be embedded in a separate script for execution. I sincerely appreciate any advice you can give.
Anders#
Mixing ProgramFiles and user files in the same installer is not recommended.

The Microsoft guidelines say that you should install to ProgramFiles. When a user runs your application for the first time, the application itself should copy your template files from a shared location (%programfiles% or %programdata%) to the users profile.

If you don't want to follow the rules, you can use a hack like GetUserShellFolderFromRegistry

See also:
- NSIS best practices
jlh@sfs#
That makes perfect sense and it can be done with the existing installer. Thanks for the lesson.