If you're making a module for the Netduino Go, you'll probably need to distribute some driver libraries to go along with it. Providing a module driver installer is a great way to make it extremely easy for your users to get started with your module.
NSIS is a popular free and open source Windows installation system. NSIS is script-based, and allows you to use relatively simple scripts to define the behavior of your installer. I have created an NSIS script that can be used as a starting point for Netduino Go module driver installers.
This script copies all the necessary files for your module to a directory within the Program Files directory. It also creates the registry keys necessary for your assemblies to appear within Visual Studio's "Add Reference" window for .NET Micro Framework projects.
Additionally, an uninstaller is created and users will be able to uninstall your drivers through the "Add/Remove Programs" control panel.
This script generates a single installer executable that works on both 32 and 64-bit systems. It has been tested on Windows XP, Vista, and 7.
This script is distributed under the Apache License 2.0.
To use this script:
- Install the latest version of NSIS.
- Download the script (attached to this post, see below for link).
- Copy the script to your library's solution folder. I recommend creating an "Installer" directory within your solution folder and copying the script files there. This keeps all the files related to the installer (including any custom icons or other plugins, etc.) contained and separate from the rest of your code.
- Update the settings in the first part of Installer.nsi (see below for more details). The .nsi and .nsh files are just plain text files that can be edited with Notepad or any other text editor, but several NSIS development environments are available. I like HM NIS Edit.
There are a few important settings you should update in Installer.nsi:
- Your company name, product name, website, etc.
- The installer version number. You can use any version number you'd like, but it must be in X.X.X.X format.
- If you would like to include a EULA page in the installer, uncomment the EULA Filename line and specify a file that contains your EULA text. This can be either a plain or rich text file.
- The .NET Micro Framework version you are targeting (e.g., v4.2). This is used for the installation path (to keep different .NETMF versions separate) and for the registry keys that make your assembly appear in the "Add Reference" dialog.
- A list of all assemblies you'd like to include in the installer. For each assembly, specify the target name (i.e., the assembly filename without the .dll extension) and the build output directory. You can include multiple assemblies if necessary, and instructions for doing so are provided within the configuration section of Installer.nsi.
There are a few other settings as well:
- The installer output filename. By default this will include the full product name and version.
- Custom installer/uninstaller icons.
- A link to be shown on the installer's Finish page, typically used as a link for "Getting Started" documentation.
- Default installation directory, defaults to "Company Name\Product Name" (within the Program Files directory).
After updating the script with your settings, you should be able to compile the script to generate your installer. If you are using one of the NSIS IDEs, there should be a menu item or button within the program to compile the script. Otherwise, you can compile it from the command line:
"%PROGRAMFILES(X86)%\NSIS\MakeNSIS.exe" Installer.nsi
I have included a batch file called "CompileInstaller.bat" to make this a little easier.
Please let me know if you find this useful or if you have any questions
Matt