Visual Studio 2010 Setup project is missing in Visual Studio 2012, So use NSIS

December 30, 2012

So, yes it’s true. Microsoft decided that the “Setup project” no longer part of the Visual Studio patterns and all of us stuck with none working,

none loading Setup project. More than that now we are missing installer for our product.

So, this post is not for the big and compose product that already didn’t use this project type, but for the medium & small product that needed simple installer

that had basic functionality as:

  • File deployment
  • Registry writing
  • Service installation & Management

 

You can see that Microsoft suggest to move to “InstallShield Limited Edition”  by FLEXERA, but still main features are missing (you can see here).

I used InstallShield in the past and it’s a magnificent tool and have one of the best integration with the Visual Studio and many features and great extension ability.

The only issue with it, is that it’s NOT FREE and by now we had free and satisfied installer till now.

 

So, I suggest to move to NSIS installer platform (you can find it here)

 

NSIS gives it all.

Like all installers NSIS give as all the functionality we need and more than that, the only thing that it script base installer and not so friendly.

Still for it’s cost FREE it’s more that better!!!

I want to give basic functionality that was provided by Microsoft Setup project and taken from us:

 

Files deployments:

NSIS support files installation and un-installation

for example:

File “Installer Files\*.exe” : install all *.exe files under ‘Installer Files’ directory, it’s also will be the name of the directory that the file will be taken from and install into

To take and locate file from sub-folder first:

SetOutPath$INSTDIR\Sub-Folder”

Than call:

File  “Installer Files\Sub-Folder\*.dll” :all dll files under Sub-Folder

 

Service Installation:

NSIS support service installation, un-installation and management. For this I used the SimpleSC plug-in (for what I know it’s only works on NSIS 32bit)

Basic functionality on services:

 

Get Service status:

SimpleSC::GetServiceStatus “[The service name]”
Pop $0 ;Error code
Pop $1 ; service status

   1: service_status - one of the following codes

   2: 1 - SERVICE_STOPPED

   3: 2 - SERVICE_START_PENDING

   4: 3 - SERVICE_STOP_PENDING

   5: 4 - SERVICE_RUNNING

   6: 5 - SERVICE_CONTINUE_PENDING

   7: 6 - SERVICE_PAUSE_PENDING

   8: 7 - SERVICE_PAUSED

 

Stop Service:

SimpleSC::StopService “[The service name]” 1 30
Pop $0 ; error code

 

Install Service:

SimpleSC::InstallService  [name_of_service] [display_name] [service_type] [start_type] [binary_path] [dependencies] [account] [password]

 

Service Type (most of the time – 16)

   1: service_type - One of the following codes

   2: 1 - SERVICE_KERNEL_DRIVER - Driver service.

   3: 2 - SERVICE_FILE_SYSTEM_DRIVER - File system driver service.

   4: 16 - SERVICE_WIN32_OWN_PROCESS - Service that runs in its own process. (Should be used in most cases)

   5: 32 - SERVICE_WIN32_SHARE_PROCESS - Service that shares a process with one or more other services.

   6: 256 - SERVICE_INTERACTIVE_PROCESS - The service can interact with the desktop.

   7: Note: If you specify either SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS, and the service is running in the context of the LocalSystem account, you can also specify this value. Example: SERVICE_WIN32_OWN_PROCESS or SERVICE_INTERACTIVE_PROCESS - (16 or 256) = 272

   8: Note: Services cannot directly interact with a user as of Windows Vista. Therefore, this technique should not be used in new code. See for more information: http://msdn2.microsoft.com/en-us/library/ms683502(VS.85).aspx

 

Service Startup type (most of the time – 2)

   1: start_type - one of the following codes

   2: 0 - SERVICE_BOOT_START - Driver boot stage start

   3: 1 - SERVICE_SYSTEM_START - Driver scm stage start

   4: 2 - SERVICE_AUTO_START - Service auto start (Should be used in most cases)

   5: 3 - SERVICE_DEMAND_START - Driver/service manual start

   6: 4 - SERVICE_DISABLED - Driver/service disabled

 

Custom Pages:

NSIS come with default pages and page flow, and still it’s support custom pages you can define and set their on functionality.

Still there are many custom pages on the web, look for them first before creating new ones

 

For Example:

User & Password page, there are several examples on the downloaded example folder when you installed the NSIS

This custom page will need “PassDialog.dll” see here

 

*** Remember all plug-ins that you want to use must be located at [Drive]:\Program Files (x86)\NSIS\Plugins (if you run on 32 bit)

 

For Last.

NSIS can cover must of our installer requirements and more, there are many implementation for all cases (Silent installer, quick installer, etc.) and windows (Services, Registry, special parameters, etc.)

Just look for it

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

one comment

  1. PiniDecember 31, 2012 ב 05:17

    VS 2010 Has a vdproj you can use for everything.
    Besided WIX is much better in any way

    Reply