This post is related to creating a installer of windows form or WPF application that you have created & now need to install it on other PCs with .NET framework. I hope you will understand it. This post can answer Solution of How to make a setup installer? how to Deploy C# application with .Net 4.0 , How to create a setup on install Shield to install two programs. How to Add .Net Framework 4.0 into setup project. How to run my project(windows forms) c# in a different computer. How can I make a program work on different computers independent of .NET Framework? C# , how to Deploy C# application on any computer?
Creating Setup & Deployment in Visual Studio
1. Windows installer:
|create new project>other project type> setup and deployment> visual studio installer|
Types of Installers & Which one to choose from above picture?
Web Setup Project
Merge module project
Customizing an installer:
|Customizing an installer|
|File System Editor, Registry Editor, File Types Editor, User Interface Editor, Custom Actions Editor, and Launch Conditions Editor|
File system editor;
User interface editor;
|User Interface Editor|
Custom actions editor;
|Custom Actions Editor|
File Types editor;
Launch conditions editor;
|File Search Properties|
|Registry Search & Component Search from MSDN|
To make your application run in any version of .NET framework, right click on Requirement on Target Machine and then click Add .NET Framework Launch Condition, in properties window change Version to Any. There are editors available in setup project in visual studio.
Choosing prerequisites to install:
Sometimes your application may depend on components that must be available in target computer before the installation can take place. If one of those dependent components is not available, an error message will be raised and installation will be aborted!
You can make your user fill happy without a list of error messages, by including some prerequisites to be installed if not available in target computer.
To choose which one to be included in your package, right click on your deployment project and select properties, in the Property Pages dialogue box, expand the Configuration Properties node, and then select the Build property page. Click the prerequisite button and make sure that the Create setup program to install prerequisite components box is checked. Then select the prerequisites that you want to install from the Choose which prerequisites to install list.
|Adding Pre Requisites to Setup Installer|
Here you can select example the .NET framework version and windows installer version and other prerequisites from the dialog box.
Down the dialogue there is specify the install location for prerequisite, and three radio buttons are available:
|Details of Prerequisites|
This capability to automatically detect the existence of components during installation and install a predetermined set of prerequisites is referred to as bootstrapping and the component that performs it is called the generic bootstrapper which uses bootstrapper packages to install the prerequisite components on the target computer.
The default location of the bootstrapper packages is stored in the registry key HKEY_LOCAL_MACHINESoftwareMicrosoftGenericBootstrapper4.0Path. Changing this path will change the location in which the Prerequisites Dialog Box looks for bootstrapper packages.
Creating installer for 64 bit platform:
The deployment tools in Visual Studio allow you to create installers for 64-bit applications and components. The TargetPlatform Property of a deployment project determines whether an installer will target a 32-bit or a specific 64-bit platform. The target platforms are x86 for 32-bit platforms, x64 for computers supporting the AMD64 and EM64T instruction sets, and Itanium for the 64-bit Itanium processor.
In general, 32- and 64-bit Microsoft Installer (MSI) packages are treated in the same way except for how Windows Installer treats folder variables such as Program Files and System Folder, and how it writes components into the registry or GAC. To create a 64 bit installer select your setup project and in the properties window change TargetPlatform to either Itanium for an Intel Itanium 64-bit platform, or x64 for any other 64-bit platform (such as AMD64 and EM64T instruction sets).
|Creating Installer for 64 Bit Windows OS|
Security in windows installer:
Windows Installer can use digital signatures to detect and correct corrupted resources. In Windows XP, Windows Installer is integrated with Software Restriction Policy to restrict both administrators and non-administrators from running program files based on the path, URL zone, hash, or publisher criteria.
Also you can sign an assembly which gives an application a unique identity that other software can use to identify and refer explicitly to it (process also called strong-name signing). A strong name consists of its simple text name, version number, culture information (if provided), plus a public/private key pair. This information is stored in a key file; this can be a Personal Information Exchange (PFX) file or a certificate from the current user’s Windows certificate store.
To sign an assembly, right click on project and click properties, from the project form click the signing tab and then select the sign the assembly. From a Choose a strong name key file drop-down list, select either<new…> if you want a new key file or <browse…> for an existing file. For new file enter a name and password in the Create strong Name key.
|Security in Setup Installer – Creating Strong Name Key|
Now rebuild your application and then a setup project to get a .msi file ready for installation.
2. ClickOnce technology:
To make a ClickOnce application available to users, you must publish it to a Web server, file share, or removable media. You can publish the application by using the Publish Wizard; additional properties related to publishing are available on the Publish page of the Project Designer.
|Publishing using ClickOnce for Setup Creating|
Publish properties can be set using the Publish Wizard but only a few of the properties are available in it, all other properties are set to their default values. Now let’s look at the properties that can be changed in this Publish page:
You can publish the application to a Web site, FTP server, or file path. Type the location as a disk path, file share, FTP site, or Web site URL, or click the Browse button to browse for the location.
Specify a local disk path from which you can copy the application to a CD-ROM or DVD-ROM. The path can be a relative or absolute path in standard Windows format, for example: C:DeployDIC.
Specify a file share by using a Universal Naming Convention (UNC) path from which the application will be deployed, for example: ServerNameDIC.
Specify the path of a Web site from which the application can be downloaded by using FTP, for example: ftp://ftp.fileServer.com/DIC.
Specify the URL of a Web site from which the application can be downloaded by using HTTP, for example: http://www.website.com/DIC.
Install mode and settings;
First you have to say if the application is available offline or not (online only). If you select The application is available online only, then it will be run directly from the publish location without creating a shortcut on thestart menu. Otherwise the application will be available even if a user is disconnected from the network and a shortcut will be available on start menu.
Also you can click on Prerequisites.. button to specify which prerequisite to be included. The prerequisite dialog is the same as the one explained above in windows installer.
Father more, if you set your application to be available offline, you can set application updates either automatically or programmatically. Also you can configure the application to check for updates automatically before the application starts, or at set intervals after the application starts. In addition you can specify a minimum required version; that is, an update is installed if the user’s version is lower than the required version.
To increase publish version, increase major, minor, build or revision version number according to what updates you have made! Changing the number in these fields causes the application to be published as an update. Also you can clear the Automatically increment revision with each publish if you don’t want visual studio to automatically increment the clickOnce publish version.
Then click on Publish Now to publish your application after making sure that all settings of your application have already been set correctly.
Security in ClickOnce:
ClickOnce security relies on Authenticode certificates to determine whether an application should be installed, a step known as a trust decision. Application and deployment manifests that describe an application can be signed with a certificate to prevent tampering. Domain administrators can configure certificates to be trusted at the enterprise or machine level. If certificates are not trusted at the time of installation, ClickOnce deployment can be configured to ask users to make trust decisions. Once an application is installed, ClickOnce restricts the application permissions and actions as defined by the Internet, Local Intranet, or custom zones.
3. InstallShield 2010 Limited Edition:
Microsoft has partnered with Flexera, makers of InstallShield to create InstallShield LE for Visual Studio 2010. This is a Visual Studio extension you can download and use today to build Windows installer-based deployment packages for your application that can be deployed on the Windows platform. It provides comparable functionality to the Visual Studio Installer project but in addition, you get the easy to use, modern, graphical development environment of InstallShield, as well as the ability to build your deployment projects using Team Foundation Server.
First time users need to enable InstallShield LE by downloading and installing it. Go to create new project and select InstallShield. After creating the project the template will bring you to registration page and then the download link. Once you have installed the product, the new project dialog will provide an option to create an installShield LE project. Now after creating a new project, the first form is where we start now:
|InstallShield 2010 Limited Edition|
At the bottom of the screen are the steps to the installation project and I am going to talk a little on them. (Using the next button will make sure you have passed on all steps)
Here you will feel the basic information about the application including application name and version.
Specify the prerequisites that must be installed including version of OS and .NET framework. Customer prerequisites can be defined under create a custom software condition
This step is disabled in the Limited Edition. In the other editions different features can be defined for users to choose what sections they want installed.
The application files such as project output can be added here (don’t forget to add primary output).
|Visual Studio Output Selector|
Here you can define shortcuts for Start menu and desktop. Click on New, on the dialog select programFilesFolder>your company name>product name and you will find the primary output of your application, then tick on where you need the shortcut to be available and an icon if any.
If the application requires any registry entries, they can be defined here.
This defines the user interface by specifying which dialogs should be displayed to users and which should not. Also you can create a custom dialog but this feature is not available in limited edition.
Also in solution explorer, there are many other features and explanation about advanced issues in deployment. You can view them for more information and customization.
Now you can build it to get a .msi file for installation which can be found from SetupNameSetupNamaExpressDVD-5DiskImagesDISK1.
NOTE: If you made any changes to your application, first rebuild your application before building the installer.
I finally installed my application in my computer.
|Install Shield Wizard|
This is the end of this tutorial about setup and deployment in VS2010. Good to say is that many concepts from this tutorial I studied them from Microsoft Developer Network Library.
1 thought on “Create Setup Installer for Projects in Visual Studio”
Hello! I could have sworn Ive visited this website before but after browsing through many of the articles I realized its new to me. I’m certainly happy I stumbled upon it and Ill checking back regularly!
Comments are closed.