Skip to content
⌘ NSIS Forum Archive

Could i compile an .nsi-file in runtime

11 posts

wolf67#

Could i compile an .nsi-file in runtime

My thougt is this. I want to compile and create an istallation file from an nsi-file. And i want to start all of that from an C# application and on every time I want to include a new ini-file in the compilation. Is there any way to do this?
wolf67#
More questions

When i compile whith "makensis" i want to set different output library for the installation file and a filepath to an .ini-file in the command line. Could i do that and how to take care of it in my .nsi-file?
zimsms#
I did something similar. The way I set up my build environment allows me to have an nsis make file which builds nsis installers based on information in ini files. You can find an example of my build environment via this thread.

Cheers!
wolf67#
I am new on this, Could you help me a little bit? I have tried to:
!define File 
in my .nsi-file and in makensis
makensis /V4 /Olog.txt /DFile=aku.ini aku5.nsi 
and i get the follow error "!define: "File" already defined!". My thougt is this. Every instance of the setup.exe should contain a unique version of the ini-file because i have a serialnumber in it which is unique for every setup.exe. Could i declare a file path to the ini-file and send it in the makensis command and take care of it in the .nsi-file?


Sorry for my bad english
zimsms#
Well to start off "File" is a reserved word. Try:

!define MyFile 
or:

makensis /V4 /Olog.txt /DMyFile=aku.ini aku5.nsi 
wolf67#edited
"makensis /V4 /Olog.txt /DMyFile=C:\Program\NSIS\aku.ini aku5.nsi"; 
this works a bit on the way, How should i take care of it in my .nsi-file? I tried
File "MyFile" 
and
File /nonfatal /a /r "MyFile" 
but i doesnt work😕

This displays in the log file for .nsi
Command line defined: "MyFile=C:\Program\NSIS\aku.ini" 
and this
File: "MyFile" -> no files found. 
It should contain the file path so the script knows where to find the .ini-file.
wolf67#
Still not working
File: "$MYFILE" -> no files found. 
This drive me crasy i think.

This is how the section looks like:
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
;File "aku.ini"
File "C:\Akupunktör_klient\Akup.exe"
CreateDirectory "$SMPROGRAMS\Akupunktör"
CreateShortCut "$SMPROGRAMS\Akupunktör\Akupunktör.lnk" "$INSTDIR\Akup.exe"
CreateShortCut "$DESKTOP\Akupunktör.lnk" "$INSTDIR\Akup.exe"
File "..\..\..\..\Webbserver\ApacheGroup\Apache2\htdocs\Akutest\reg2.php"
File "..\..\..\..\Webbserver\ApacheGroup\Apache2\htdocs\Akutest\index3.php"
File "..\..\..\..\Webbserver\ApacheGroup\Apache2\htdocs\Akutest\verreg.php"
File "..\..\..\..\Webbserver\ApacheGroup\Apache2\htdocs\Akutest\valkomna2.php"
File /nonfatal /a /r "$MYFILE"
SectionEnd

any ideas?