Click here to Skip to main content
Click here to Skip to main content
Go to top

Deploy your Application or Component Using Windows Installer

, 3 Sep 2006
Rate this:
Please Sign up or sign in to vote.
An article on creating setup programs without having the knowledge of setup scripts

Introduction

Whenever we hear about deployment of our application or component, we get scared with the traditional scripted setup programs. The main goal of this article is to get .NET programmers used to this easy to setup program which allows you to deploy your application even if you don't know how to write the setup script. Microsoft .NET Setup & Deployment will make the setup for you with simple clicks. It is also provided with self taught easy driven wizards. Many programmers who are using Microsoft Visual Studio .NET are not fully aware of this Windows installer that comes with Visual Studio; they are going for other setup programs that need hard scripting knowledge. Using Windows Installer is very easy.

About Microsoft Windows Installer

Windows Installer enables you to deploy your Applications and Components in an efficient manner. The installer provides new capabilities to advertise features without installing them, to install products on demand, and to add user customizations. Windows Installer is an installation and configuration service that reduces the total cost of ownership. The installer enables customers to better address corporate deployment and provide a standard format for component management.

Run-Time Requirements

This technology is available as a redistributable for Windows Installer version 2.0, from Microsoft Downloads.

Features of Windows Installer

  • It is based on a data-driven model that provides all installation data and instructions in a single package. In contrast, traditional scripted setup programs. 
  • It also supports self-repair — the ability for an application to automatically reinstall. 
  • It provides the ability to roll back an installation. The deployment tools in Visual Studio .NET build on the foundation of Windows Installer, providing you with rich capabilities for rapidly deploying and maintaining applications built with Visual Studio .NET. Creating your first Deployment Project, Visual Studio provides templates for four types of deployment projects:
    1. Setup Project builds an installer for a Windows-based application.
    2. Merge Module Project (.msm) is used to pack components that might be shared by multiple applications.
    3. Web Setup Project builds an installer for a Web application.
    4. Cab Project (.cab) creates a cabinet file for downloading to a legacy Web Browser In addition, a Setup wizard is provided to help step you through the process of creating deployment projects.
  • For a Setup project, the installer will install files into a Program Files directory on a target computer.
  • For a Web Setup project, the installer will install files into a Virtual Root directory on a Web server.

Note: If you have created a standard deployment project and later decide to deploy it to a Web, you will need to create a new project.

Five Easy Steps

Step 1

Open the Visual Studio IDE, and select File->New ->Setup and Deployment Projects. Select the Setup Wizard. Give the File name and location where to store that project as shown in the below figure:

Step 2

Welcome to Setup Project Wizard will appear. It is a simple Four Step Wizard. Click on the Next Button. In the second step on the wizard, it will ask the type of the setup. Choose the appropriate one. Here, I have chosen setup for Windows application and click Next.

Step 3

In the third step of this wizard, it will ask to add your developed application or component and other files that you need to place in the clients machine, for example, say documentation files.

Now, it will display as shown in the below figure.

Step 4

As you can see in the above figure, the application folder is the folder where your application and supported files will be installed. User's Desktop and Programs Menu are the client's desktop and program's menus respectively. If you place the short files of your main application & help files on the user's desktop and programs menu, then during the installation the application, supported files and the shortcuts will be placed automatically as you directed by placing the intended files in the application, user desktop directories and programs menu.

We can use the following editors during the deployment of our application.

You can find these editors in the solution explorer each as a button as shown below:

File System Editor

It allows you to add project outputs, files, and other items to a deployment project and specify where they will be installed on the target computer.

Registry Settings Management Editor

It allows you to specify registry keys and values to be added to the registry of the target computer.

File Types Management Editor

It is used to establish file associations on the target computer.

Custom Actions Management Editor

It allows you to specify additional actions to be performed on the target computer at the end of an installation.

Launch Condition Management Editor

It allows you to specify conditions that must be met in order to successfully run an installation.

User Interface Management Editor

As shown in above figure, User InterfaceManagement Editor is used to specify and set properties for predefined dialog boxes that are displayed during the installation on the target system.

The Customer Information Dialog is important to protect your software.

For that first set, the Show SerialNumber property to true (false by default).

There will be a template for the serial key called SerialNumberTemplate:

Valid editable characters for the SerialNumberTemplate property are:

Character Meaning
# Requires a digit that will not be included in the validation algorithm.
% Requires a digit that will be included in the validation algorithm.
? Requires an alphanumeric character that will not be included in the validation algorithm.
^ Requires an uppercase or lowercase character. Numeric digits are not valid here.
< Any characters to the left of this character will not be visible in the dialog box.
> Any characters to the right of this character will not be visible in the dialog box. Required as a terminator if the < character is used.

Note that any other character is treated as a literal constant.

The Default template is <###-%%%%%%%>, which creates two text boxes separated by a dash surrounded by spaces.

The first has # which means that use must enter three numbers but those numbers will not be participating in the validation algorithm.

The second box has seven digits, % means that it will be involved in the validation. We apply modulo 7 to the sum of these required digits and if it equates to 0, the algorithm returns true and the user can proceed to the next dialog box.

Example
<###-%%%%%%%>, 

124 - 7134501 is one of the keys by which the user can proceed to the next dialog box.

The first three digits 1, 2 and 4 can be any digits as they will not participate in validation.

The next seven digits 7134501 when you sum them will give you 21 and if you apply 21%7 you will get 0 so this is ok. Likewise, you have to proceed.

You can add the dialog boxes like end user license agreement dialog and serial key dialog as shown.

Step 5

When you build the application, you will find the install program for your software or component in the projects debug directory.

Conclusion

I hope that many of the .NET developers who are using traditional setup script programs will find this as a easy and simple way to deploy your software. More than that, if you got the licensed Visual Studio .NET, then there is no need to purchase setup applications from other companies as Visual Studio .NET itself offers it. I think that I have given enough features of Windows Installer that come with Visual Studio .NET. Now it's time that you try it just once to get used to it.

History

  • 1.0 - 13 Feb 2006
    • First release version
  • 1.1 - 4 Sep 2006

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Prabhakar Manikonda
Architect IBM Sandton South Africa
South Africa South Africa
Prabhakar Manikonda
MS CS, M.A SW, MCSD.NET, MCTS Sharepoint 2007, 3.0 Services
 

 
Proven track record with seeing successful projects through to completion. Excellent team player and completer-finisher. Specialist in methodology, architecture,object-oriented design, and project management. Plan and manage workload, monitoring and resolving programming issues Transform requirements into architectural, Publishes white papers and articles in software development and runs software consulting & recruiting

Comments and Discussions

 
GeneralMy vote of 4 PinmemberTurner K James17-Dec-10 10:20 
GeneralMy vote of 5 Pinmemberel_rahul28-Oct-10 22:01 
QuestionHow to add my own algorithm for serial key Pinmemberel_rahul28-Oct-10 21:59 
GeneralSetup to deploy only in 2 systems... PinmemberSumit.smith2-Jun-10 20:28 
QuestionCan I access the serial number after installation? PinmemberMember 345539824-Oct-08 15:30 
AnswerRe: Can I access the serial number after installation? PinmemberMitchellBaldwin8-Dec-08 9:49 
GeneralRe: Can I access the serial number after installation? PinmemberMember 345539811-Dec-08 2:50 
GeneralRe: Can I access the serial number after installation? PinmemberMitchellBaldwin11-Dec-08 4:17 
GeneralRe: Can I access the serial number after installation? PinmemberMember 345539811-Dec-08 8:00 
AnswerRe: Can I access the serial number after installation? PinmemberMartchap31-Jan-09 9:00 
QuestionHow to solve Login Fail? Pinmemberkhinezw20-Aug-08 0:23 
GeneralProduct Key Pinmembersonudevgan20-May-08 2:59 
GeneralRe: EULA (license agreement) Pinmemberpraveenkumar palla28-Mar-08 20:46 
GeneralRe: EULA (license agreement) PinmemberPrabhakar Manikonda8-Apr-08 2:01 
QuestionGet rid of .net framework PinmemberGabriel X20-Dec-07 7:04 
GeneralRe: Get rid of .net framework Pinmemberfadee12-Feb-08 0:55 
GeneralMy own Key PinmemberExelioindia3-Sep-07 20:32 
Questioncopy additional files during installation process ? PinmemberJatin Prajapati25-Aug-07 7:21 
Questionpath of .msi file PinmemberProsGIS21-Aug-07 4:26 
GeneralRe: path of .msi file Pinmembermaznblue3-Apr-08 4:26 
Questionwhat can i do,if i want use the serialnumber of myself? PinmemberWan--Vevi1-Aug-07 21:29 
AnswerRe: what can i do,if i want use the serialnumber of myself? PinmemberIvo8630-Sep-07 21:23 
GeneralThanks PinmemberMohamed Imtiyaz23-Jul-07 4:55 
QuestionHow to validate product code PinmemberRajkumar Reddy22-May-07 19:35 
Generalerror during install Pinmemberhar1132-May-07 6:48 
Generalsetup project Pinmembertbtrieu3-Apr-07 17:15 
GeneralRe: setup project Pinmembersonudevgan20-May-08 3:07 
QuestionICON for shortcut on the Desktop PinmemberEyungwah1-Feb-07 10:17 
AnswerRe: ICON for shortcut on the Desktop PinmemberPrabhakar Manikonda4-Feb-07 2:46 
QuestionDisabling self-repair Pinmemberkissmoses8-Sep-06 1:36 
Generalserial key PinmemberGuerven27-Aug-06 19:54 
GeneralRe: serial key PinmemberPrabhakar Manikonda3-Sep-06 19:22 
GeneralRe: serial key PinmemberExelioindia3-Sep-07 20:16 
GeneralWhere can I find those Editors PinmemberKunyao_chen3-Jul-06 3:52 
GeneralRe: Where can I find those Editors PinmemberPrabhakar Manikonda3-Sep-06 19:59 
GeneralRe: Where can I find those Editors Pinmember_alank8-Sep-06 5:43 
Generalsetup application with crystal report Pinmemberghasempoor6-Jun-06 22:16 
GeneralRe: setup application with crystal report Pinmember_alank8-Sep-06 6:18 
Generalhelp needed regarding .msm PinmemberMegha Bansal31-May-06 20:33 
GeneralRe: help needed regarding .msm [modified] Pinmember_alank8-Sep-06 6:47 
Questioninstallation after installation ? PinmemberMastarezma21-May-06 22:16 
AnswerRe: installation after installation ? Pinmember_alank8-Sep-06 7:24 
GeneralAutomatic install of the .net package PinmemberAssaf Koren12-May-06 21:34 
GeneralRe: Automatic install of the .net package PinmemberPrabhakar Manikonda14-May-06 20:59 
GeneralMultiple language Pinmemberalamatula4-Apr-06 10:59 
GeneralRe: Multiple language PinmemberPrabhakar Manikonda4-Apr-06 21:02 
GeneralRe: Multiple language Pinmemberalamatula6-Apr-06 7:34 
Generalbroken links Pinmembertoxcct31-Jan-06 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 4 Sep 2006
Article Copyright 2006 by Prabhakar Manikonda
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid