Old 5th January 2011, 01:21   #1
insertjokehere
Junior Member
 
Join Date: Jan 2011
Posts: 3
Integrating NSIS with Visual Studio/MSBuild

Hi Guys,

Ive seen a few people asking about building NSIS installers with Visual Studio (MSBuild), so i whipped up a custom MSBuild task that should let you accomplish this.

Full source and an example is included in the attachment below, as well as a template for adding this to your own solution. just open template.vbproj, and edit as needed

NOTE: This took me about an hour to do. It hasnt been tested very thoroughly. It probably meets most definitions of the term "Dirty Hack". YMMV.

i will be happy to answer any questions/problems/feature requests/feedback etc

Thanks,

->InsertJokeHere<-
Attached Files
File Type: zip NSISCTask.zip (10.0 KB, 552 views)
insertjokehere is offline   Reply With Quote
Old 5th January 2011, 07:57   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 548
Send a message via ICQ to T.Slappy
Hi
Your idea looks great but I got a lot of errors when I tried to compile your project.

I am using Visual Studio 2008 and your project is for VS 2010, so I downgraded .sln and related stuff.
Then I got lot of error for Microsoft.Build.Utilities.v4.0 which you are using, because I use Microsoft.Build.Utilities.v3.5.
Quote:
Error 1 'GeneratedCodeAttribute' is ambiguous in the namespace 'System.CodeDom.Compiler'.
Error 2 'EditorBrowsableAttribute' is ambiguous in the namespace 'System.ComponentModel'.
Error 3 'EditorBrowsableAttribute' is ambiguous in the namespace 'System.ComponentModel'.
Error 4 'GeneratedCodeAttribute' is ambiguous in the namespace 'System.CodeDom.Compiler'.
Error 5 'EditorBrowsableAttribute' is ambiguous in the namespace 'System.ComponentModel'.
Error 6 'ApplicationSettingsBase' is ambiguous in the namespace 'System.Configuration'.
Error 7 'ApplicationSettingsBase' is ambiguous in the namespace 'System.Configuration'.
Error 8 'HelpKeywordAttribute' is ambiguous in the namespace 'System.ComponentModel.Design'.
Error 9 Name 'NSISEngine' is not declared.
Error 10 Name 'NSISEngine' is not declared.
Error 11 'Process' is ambiguous in the namespace 'System.Diagnostics'.
Error 12 Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.
Error 13 Statement cannot appear within a property body. End of property assumed.
Error 14 Property missing 'End Property'.

All this errors are related to .net Framewrok - in your version [4.0] everything is present, but not in 3.5 which I use.
So is there possibility for you to create a lower version? I mean target framework should be 3.5.

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 5th January 2011, 08:58   #3
insertjokehere
Junior Member
 
Join Date: Jan 2011
Posts: 3
Couldnt figure out how to edit my original post, so i will just make another one.

Attached is a zip containing both visual studio 2010 and visual studio 2008 version (.net 4 and .net 3.5 respectively). they should behave exactly the same. The visual studio 2008 version may give you a security warning about custom tasks (because it contains custom tasks), but this can be safely ignored
Attached Files
File Type: zip NSISCTask.zip (29.1 KB, 670 views)
insertjokehere is offline   Reply With Quote
Old 10th January 2011, 09:24   #4
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 548
Send a message via ICQ to T.Slappy
It is much better, Thanks!

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 18th September 2012, 17:21   #5
AC_Sherway
Junior Member
 
Join Date: Sep 2012
Posts: 1
hey, i don't know if you still follow this, but i am interested in making this work, but i am kind of noob when it comes to these extra features of visual studio.

how do i make my existing project into an NSIS installer package using this?

i have NSIS installed and i downloaded the VS2010 zip file you attached, but i don't know where to fit the pieces :|
AC_Sherway is offline   Reply With Quote
Old 18th September 2012, 23:51   #6
insertjokehere
Junior Member
 
Join Date: Jan 2011
Posts: 3
1. Grab the zip in my second post, and extract it somewhere
2. Pick the appropriate folder for the visual studio version you are using
3. move the NSISCTask folder into the folder for your visual studio solution
4. add the project for that folder as a project in your solution inside visual studio
5. edit template/template.vbproj with a text editor
6. set the <Compile Include="..." /> line to have the name of your .nsi file
7. if you have any .nsh files, add them as <Header> entries, otherwiser remove that whole ItemGroup
8. set NSISEngine to point to your makensis.exe (either in C:\Program Files\.... or C:\Program Files (x86)\...)
9. add template.vbproj as a project in your solution

you should now be able to build a .nsi from within visual studio by right clicking on this project and selecting build, or if you use some kind of continuous integration by invoking msbuild
insertjokehere is offline   Reply With Quote
Old 19th September 2012, 10:02   #7
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 548
Send a message via ICQ to T.Slappy
Hey AC_Sherway

I appreciate insertjokehere's tool but it is a really "hardcore solution".

It is a long time since this tool was published: it was great in those times but there were some problems and lack of functionality so I decided to develop my own solution called "Visual & Installer".
It is an extension for developing NSIS project directly in Visual Studio and it is really easy to use it.
Check my signature if you are interested in it, you can download it for free (Trial).

Sorry for self promotion

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
msbuild, visual studio

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump