Visual Studio .NET - create setup for a windows application

Asked By Manivannan G on 01-Oct-08 12:54 AM
I have creates a windows application in c#. I want to create a setup to this application.
I use sql server 2005 as my database. After create the setup I want to change the connection string of sql server
according to the clients system. How to do that?

Creating Setup for Applications - Binny ch replied to Manivannan G on 01-Oct-08 01:00 AM

Right Click on Soution of your project.
Click Add New Project.
Select Other Project Type ->Setup Project.
write in Name that u want to give to setup project.
click OK.

Select Setup Project.See the option above the Solution.
Go To Custom Action. you will see four folder.
Right Click on Install folder and Select Add Custom Action.

Double click on Application Folder.
Click on Add Output.Select Primary Output. And Press OK.

Now build the projects again.
The setup will be in Debug folder of your setup project.

refer these sites it will be help full

http://www.codersource.net/csharp_installer_projects.html

http://www.codeguru.com/csharp/.net/net_vs_addins/visualstudioadd-ins/article.php/c7245


http://www.15seconds.com/issue/030806.htm

this link will help: - Binny ch replied to Manivannan G on 01-Oct-08 01:01 AM

To create shortcuts for the Windows-based application

  1. Select the My Notepad Installer project in Solution Explorer.

  2. In the File System Editor, select the Primary output from My Notepad node.

  3. On the Action menu, choose Create Shortcut to Primary Output from My Notepad.

    This will add a node called Shortcut to Primary output from My Notepad.

  4. Rename the shortcut Shortcut to My Notepad.

  5. Select Shortcut to My Notepad and drag it to the User's Desktop folder in the left pane.

Creating a File Association

This step adds a file association for My Notepad so that double-clicking .vbn files open the My Notepad application.

To create file associations for the Windows-based application

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and then choose File Types. The File Types Editor appears.

  2. In the File Types Editor, select the File Types on Target Machine node. On the Action menu, choose Add File Type.

    A node named New Document Type #1 is added and opened for renaming.

  3. Rename New Document Type #1 as Vbn.doc.

  4. In the Properties window, set the Extensions property of the file type to vbn.

  5. Select the Command property and click the ellipsis (...) button. In the Select Item in Project dialog box, navigate to the Application Folder, and select Primary output from My Notepad.

  6. Click OK to close the dialog box

http://msdn.microsoft.com/en-us/library/k3bb4tfd(VS.80).aspx

create setup - Perry replied to Manivannan G on 01-Oct-08 01:03 AM

Hi,

You can create setup by adding new project in your project. Create new project and select setup project. You wiill find the dictionary structure that you need to changed to meet your requirement. There will be function while installing what are the steps you need to perform and while uninstalling what the dir you want to delete.

To add connection string I would suggest you to create config file where you can specify the client system and connection string as a value. While installing you can change it by reading this config file.

-Megha
Issue - John Smith replied to Manivannan G on 01-Oct-08 01:18 AM

If you want to do this you can add App.Settings file in your application. After that when you install that application on client side you can edit that App.Settings file in notepad and change the connection string as you want.

You can create setup project from other projects.

re - Web Star replied to Manivannan G on 01-Oct-08 01:42 AM

create setup

 I noticed that there are several articles on using Web Setup projects, but no articles could be found for Windows Setup projects. So I decided to share what I know about the VS Windows Setup Projects. I will be using the RunOnlyOnceCS.exe demo app I created for another CodeProject article, as the application we are creating the setup for.

as follows

http://www.codeproject.com/KB/dotnet/Win_App_Setup_Project.aspx

Create EXE or Setup File in .NET Windows Application - alice johnson replied to Manivannan G on 01-Oct-08 03:06 AM

Visual Studio 2005 Setup and deployment Projects provides to make a exe in .NET windows application is easy and rapidly

Visual Studio provides templates for four types of deployment projects: Merge Module Project, Setup Project, Web Setup Project, and Cab Project. In addition, a Setup wizard is provided to help step you through the process of creating deployment projects. You can see the templates and the wizard in the New Project dialog box under the Setup and Deployment Projects node.

The following are guidelines for choosing the right type of deployment project for your project.

1)Merge Module Project : Packages components that might be shared by multiple applications.

2)Setup Project : Builds an installer for a Windows-based application.

3)Web Setup Project : Builds an installer for a Web application.

4)Cab Project : Creates a cabinet file for downloading to a legacy Web browser.

5)Smart Device Cab Project : Creates a Cab project to deploy device applications.

This topic demonstrates deployment using a Setup and Deployment Project.

Setup Projects 

Setup projects allow you to create installers in order to distribute an application. The resulting Windows Installer (.msi) file contains the application, any dependent files, information about the application such as registry entries, and instructions for installation. When the .msi file is distributed and run on another computer, you can be assured that everything necessary for installation is included; if for any reason the installation fails (for example, the target computer does not have the required operating system version), the installation will be rolled back and the computer returned to its preinstallation state.

After you have developed your windows apllication,now you want to make a exe.how can? These steps are gives the guidance to you…

1, Go to file menu > click Add > new project >now “Add New Project” Dialog appear.

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19addnew3.png

2.Select “Other Project Types” and click “Setup and Deployment” projects,Choose “Setup Project”give name project name in name text box finally click OK.

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19setup5.png

3.New project appear in solution explorer,for example you give the name “MyEXE”..it will display with this name.

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image08.png

4.right click the MyEXE > go View > click “File System”

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image014.png

5.You can see the “File System on TargetMachine”under  three folders
Application Folder
User’s Desktop
User’s Program Menu

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image039.png

6.Select Application Folder and right click Add>Project Output>select Primary output

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image042.png

7. select User’s Desktop richt click on the second window>click create new shortcut>select output file from Application folder>change the file name from  primary output name to MyEXE

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image043.png

next >>

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image048.png

same procedure follows the user’s program menu also

8.If you want to change the Manufactures name for exe,just right click the project go to properties

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image044.png

change the properties as per you requirement

9.Finally Build the new project After successfully Build the project myEXE(Setup) will be appear in Application Debug or Release folder(depend upon the properties settings)

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image053.png

EXE available @ this location

http://balanagaraj.files.wordpress.com/2007/05/windowslivewritercreateexeorsetupfi.netwindowsapplication-ec19image059.png

When you want to install  the EXE on the client machine,you should be installed .NET Framework on that mc because,Applications and controls written for the .NET Framework version 2.0 require the .NET Framework Redistributable Package version 2.0 to be installed on the computer where the application or control runs.

Go through this link:

http://balanagaraj.wordpress.com/2007/05/29/create-exe-or-setup-file-in-net-windows-application/

reply - alice johnson replied to Manivannan G on 01-Oct-08 03:09 AM
Right click on your solution, select add new project. Expand other project types from the pop up window. Click Setup and Deployment tab, click Setup project, click ok after naming the project.
 It will start with opening file system window. Right click on application folder and select add > project output, select primary output from the opening window.
Click on User's Desktop folder and right click on the right hand-side pane. Select Create New Shortcut double click on application folder from the opening window, select primary output and click ok.
This will create a shortcut on user's desktop. Right click to ShortCut and rename it appropriately.
If you want to create a shortcut for the user's programs menu, just repeat the tasks you do for creating the Shortcut for user's Desktop.
Build the Setup project and you are done. If you build it in release mode, the setup.exe will be located in setup project's release folder, if you build it in the debug mode the setup.exe will be located in setup project's debug folder.
Lastly, if you want to install the .net framework to user's computer you have three options.
 Right click on the setup project and choose prerequisities from the opening window.
 If you want to install the .net framework from within your setup project, select download prerequisities from the same location as my application.
By default, the setup will try to download the .net framework from the internet if it is not already installed in the computer.
 Don't forget to rebuild the setup project after choosing this option.
See this Information - Sagar P replied to Manivannan G on 01-Oct-08 03:28 AM

First and imp thing is, stored your query string into Settings so that you can change it accroding to the client system. This string will be stored in Config file when you run your setup on client system.

See these steps to create a setup;

Step I:

Create one http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10895540&variation_id=133543&uts=1222845996&cpc=302e31&keyword_id=110776&inline=y&zk_id=31349663&ab=171966580&sscup=8a721ecf295e6172c581ffc900a587f3&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=72732f9e43e0dea3588f7db47255556a&rs=&r= based application in VS.Net using any of the http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10491322&variation_id=9580&uts=1222845998&cpc=302e313931&keyword_id=2949465&inline=y&zk_id=31349663&ab=171966644&sscup=4cfead4fa983bb7a449463fdae4acc48&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=eedd26c60b8d5e9953b7f3d7778c54d5&rs=&r= i.e. C# or VB.Net.

Step II:

After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.


After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.

The window appears like below and you http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10883935&variation_id=129812&uts=1222845979&cpc=302e313639&keyword_id=229919&inline=y&zk_id=31349663&ab=171966515&sscup=2388a5022b3fa187e876de0730f47e37&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=feae8380617f10867ceabfac318ff7a9&rs=&r= the Project as Setup Project and give a Name and its Location.

Step III:

After creating setup project right click on project and than select view, it will show different possible operations, which you can perform with this setup project.

The options available are
File System
Registry
File Types
User interfaces
Custom Actions
Launch conditions

Step IV:

Click on File system, it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.

Step V:

Now in the new window, its time to add the files & folder’s used by the application.

First we add the Project Output file. Click on Project Output and a new popup appears. Select the appropriate choice. For a normal project we select as Primary Output File & Content Files.
it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.

To add Icons/Any specific folders, click on Add > Folder and Folder is added. Rename the folder as per your project requirements

After the Folder is create then add the files to the setup. These will be installed in the same fashion on the target machine

Step VI:

Now we are about to create the setup before that we will setup the program icon. To do it we will do this process :

When you click on Browse, a window gets popup. Now as the icons are already added into the application setup, just click on Browse to pint to that icon and click on ok.

Step VII:

Now final step is compile the setup project. After compilation you will notice that it has generated Setup.msi in the same location which you provided when you initially created the setup project.
You can supply this msi the target machine, when you run this msi at target machine it will create a virtual directory as well as create same folder structure, which you have specified in File System. This installer will also install the specified those libraries in the registry which are specified in the Registry.
Now you can browse that application at the target machine in same way as you have done at your own machine


try this one - C_A P replied to Manivannan G on 01-Oct-08 04:38 AM

To create shortcuts for the Windows-based application

  1. Select the My Notepad Installer project in Solution Explorer.

  2. In the File System Editor, select the Primary output from My Notepad node.

  3. On the Action menu, choose Create Shortcut to Primary Output from My Notepad.

    This will add a node called Shortcut to Primary output from My Notepad.

  4. Rename the shortcut Shortcut to My Notepad.

  5. Select Shortcut to My Notepad and drag it to the User's Desktop folder in the left pane.

Creating a File Association

This step adds a file association for My Notepad so that double-clicking .vbn files open the My Notepad application.

To create file associations for the Windows-based application

  1. Select the My Notepad Installer project in Solution Explorer. On the View menu, point to Editor, and then choose File Types. The File Types Editor appears.

  2. In the File Types Editor, select the File Types on Target Machine node. On the Action menu, choose Add File Type.

    A node named New Document Type #1 is added and opened for renaming.

  3. Rename New Document Type #1 as Vbn.doc.

  4. In the Properties window, set the Extensions property of the file type to vbn.

  5. Select the Command property and click the ellipsis (...) button. In the Select Item in Project dialog box, navigate to the Application Folder, and select Primary output from My Notepad.

  6. Click OK to close the dialog box

http://msdn.microsoft.com/en-us/library/k3bb4tfd%28VS.80%29.aspx

try this one - C_A P replied to Manivannan G on 01-Oct-08 04:39 AM

First and imp thing is, stored your query string into Settings so that you can change it accroding to the client system. This string will be stored in Config file when you run your setup on client system.

See these steps to create a setup;

Step I:

Create one http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10895540&variation_id=133543&uts=1222845996&cpc=302e31&keyword_id=110776&inline=y&zk_id=31349663&ab=171966580&sscup=8a721ecf295e6172c581ffc900a587f3&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=72732f9e43e0dea3588f7db47255556a&rs=&r= based application in VS.Net using any of the http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10491322&variation_id=9580&uts=1222845998&cpc=302e313931&keyword_id=2949465&inline=y&zk_id=31349663&ab=171966644&sscup=4cfead4fa983bb7a449463fdae4acc48&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=eedd26c60b8d5e9953b7f3d7778c54d5&rs=&r= i.e. C# or VB.Net.

Step II:

After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.


After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.

The window appears like below and you http://click.adbrite.com/mb/click.php?sid=586489&banner_id=10883935&variation_id=129812&uts=1222845979&cpc=302e313639&keyword_id=229919&inline=y&zk_id=31349663&ab=171966515&sscup=2388a5022b3fa187e876de0730f47e37&sscra=f1cbe4c5dbe763cf1f1595875b7c43c0&ub=2046221959&guid=feae8380617f10867ceabfac318ff7a9&rs=&r= the Project as Setup Project and give a Name and its Location.

Step III:

After creating setup project right click on project and than select view, it will show different possible operations, which you can perform with this setup project.

The options available are
File System
Registry
File Types
User interfaces
Custom Actions
Launch conditions

Step IV:

Click on File system, it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.

Step V:

Now in the new window, its time to add the files & folder’s used by the application.

First we add the Project Output file. Click on Project Output and a new popup appears. Select the appropriate choice. For a normal project we select as Primary Output File & Content Files.
it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.

To add Icons/Any specific folders, click on Add > Folder and Folder is added. Rename the folder as per your project requirements

After the Folder is create then add the files to the setup. These will be installed in the same fashion on the target machine

Step VI:

Now we are about to create the setup before that we will setup the program icon. To do it we will do this process :

When you click on Browse, a window gets popup. Now as the icons are already added into the application setup, just click on Browse to pint to that icon and click on ok.

Step VII:

Now final step is compile the setup project. After compilation you will notice that it has generated Setup.msi in the same location which you provided when you initially created the setup project.
You can supply this msi the target machine, when you run this msi at target machine it will create a virtual directory as well as create same folder structure, which you have specified in File System. This installer will also install the specified those libraries in the registry which are specified in the Registry.
Now you can browse that application at the target machine in same way as you have done at your own machine

Stephen replied to Manivannan G on 03-Apr-12 12:02 PM
How to get the shortcut in desktop, after installing the exe.


thanks & regards,
Stephen.L