To implement PreNIS, a developer tool used alongside the Nullsoft Scriptable Install System (NSIS) to dynamically generate .nsi installer scripts from .NET project files, you must map your directory structures and integrate macro tags into a template script. System Prerequisites
Ensure the following components are ready before starting the implementation:
NSIS Compiler: The core NSIS environment installed on your system.
PreNIS Executable: Downloaded and accessible via your project directory or system path.
Visual Studio / .NET Project: A structured .csproj or folder layout containing the application files you intend to package. Step 1: Create the Source Template (.pnsi)
Instead of writing a standard .nsi file, you write a PreNIS template file (typically given a .pnsi extension). This file contains normal NSIS code mixed with PreNIS-specific macro tags.
; Example PreNIS Template (installer.pnsi) Name “My .NET Application” OutFile “Setup.exe” InstallDir “\(PROGRAMFILES\MyNetApp" Section "MainSection" SEC01 SetOutPath "\)INSTDIR” ; PreNIS Tag to dynamically loop through files File “” SectionEnd Use code with caution. Step 2: Define Core Macro Tags
Incorporate these primary structural tags inside your template file to automate resource gathering:
/ : Automatically loops through every file found in the specified build output directory.
: Evaluates to the relative path of each discovered file during expansion.
/ : Replicates your target directory tree inside the installer script automatically. Step 3: Run the PreNIS Compiler
Execute PreNIS from your command line tool or build event runner. Pass your template file as the input, which outputs a compiled, deployable NSIS file. prenis.exe installer.pnsi output_script.nsi Use code with caution. Step 4: Automate via CI/CD Build Events
To keep your installer dynamically synchronized with code modifications, insert the PreNIS executable call straight into your Visual Studio Post-Build Events: Open your project Properties in Visual Studio. Select the Build Events tab.
Paste the following snippet into the Post-build event command line text area:
“C:\Path\To\prenis.exe” “\((ProjectDir)installer.pnsi" "\)(ProjectDir)installer.nsi” “C:\Program Files (x86)\NSIS\makensis.exe” “$(ProjectDir)installer.nsi” Use code with caution. Step 5: Test and Verify
Run the final generated installer package locally. Confirm that all .dll, .exe, and configuration files match the compiled release output directory without missing dependencies.
Are you looking to integrate PreNIS into an automated CI/CD pipeline (like GitHub Actions or Azure DevOps), or do you need assistance configuring nested subfolders using PreNIS macro loops?
This is for informational purposes only. For medical advice or diagnosis, consult a professional. AI responses may include mistakes. Learn more PreNIS – NSIS – SourceForge
Leave a Reply