Question

Is there a way to compile a NSIS package as part of a build? I use MSBuild.

Update: There is a command tool called makensis as part of the NSIS download. I just executed that from my build script and handed it my .nsi file.

Example:

<Target Name="MakeDistributable">
    <Exec command="..\Tools\NSIS\makensis.exe MyDistScript.nsi" WorkingDirectory="..\Installation" /> 
</Target>
Was it helpful?

Solution

This is what I used

<Target Name="MakeDistributable">
  <Exec command="..\Tools\NSIS\makensis.exe MyDistScript.nsi" WorkingDirectory="..\Installation" /> 
</Target>

OTHER TIPS

Cruise Control .NET builds itself and creates a NSIS package as part of the build process. I recommend taking a look at its build process and source package. You will find everything you need in the nant build file in one of the source zip files from CCNet live.

I used something similar to Riri, but I think you might be interested in how I was able to make Release/Debug installers without any configuration:

Firstly, I added this to my NSI script:

!ifndef Configuration
    !define Configuration "Debug"
!endif

And then this to my msbuild target:

<Target Name="Installer" DependsOnTargets="Build">
    <Exec Command="&quot;C:\Program Files (x86)\NSIS\makensis.exe&quot; /X&quot;!define Configuration '$(Configuration)'&quot; ..\Installer\Installer.nsi" />
</Target>

This then passes in the configuration (while defaulting to Debug). I can then use it like so:

File /r /x *.xml ..\MyApp\bin\${Configuration}\*

This is very handy when sending debug builds to beta testers for example. You just need two configurations in your build server.

I am bringing up to date information:

There is 3rd party Visual Studio extension which integrates NSIS (also Inno Setup) with IDE and adds new setup projects (.exe installers) into it.

These projects are based on MSBuild so you can perform any actions on them (like any regular Visual Studio project).

They support Project Properties so you can set various symbols (like Platform x86/x64..., Configuration Debug/Release...), support Batch build, command line build and many other features.

Check extension website: http://www.visual-installer.com

(Note: I am author or this extension)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top