Search This Blog

Sunday, June 20, 2010

Create Setup for windows Application in .net


How to create Setup for windows Application in .net

Application once created will have number of associated dll and exe and other project related files and that has to be bundled in single file as MSI file. For that visual studio offers a setup project to do it.
Assume that we had created application and then we need to add a setup project from the visual studio.

Here is the first setup to add the setup project to the solution.


Step 1




Right click the solution Add New project in the pop window click the other project types and add the Setup Project as show below and rename the name of the setup project and click ok button and it will added in you solution


Setp2




Once the Setup project is added to you project. Automatically it will have the application folder, user’s Desktop, User’s Program Menu. We need to add the project output in the application folder. On right click of the application folder and we can add the project output and project will be added to the application folder.

Right Click the project output and create a short cut and we can add it in User’s Desktop folder and User’s Program menu. So that in program menu after installation the application shortcuts will be shown. If we used any other files apart from the project output right click and browse and add the needed files.


Step3





Right click the setup project file and build the setup and it will have the output MSI files in release folder of the Setup.



Step4





In VS 2005 it creates "advertised shortcuts" automatically. Shortcut launch the Windows Installer to check whether components are installed before cal ling the shortcut and it will install the components again when the application is installed by a user and opened from other user login. It will be disabled automatically.
To enable this we need to edit the MSI tables using ORCA tool. ORCA tool is used to edit database. This will be downloaded from Microsoft site from the below location.
http://msdn.microsoft.com/en-us/library/aa370557.aspx

We can to this in number of ways



First method





While installing the MSI file We need to tell the windows installer to not disable advertised shortcuts. This will cause it to create regular shortcuts instead

Open the command line

Run the setup.exe with the below command it will enable

"setup.exe DISABLEADVTSHORTCUTS"

Or create a batch file and add this lines in that batch file and on double click of the batch file

Path of the EXE and DISABLEADVTSHORTCUTS

Ex:

C:\justtotest\setup.exe DISABLEADVTSHORTCUTS



Second method





Install the ORCA.MSI.

Orca will show the List of the Tables of MSI file and Click the property table and it will show the property and value in right side window.

In Right window Right click the last row and click add new row?in property add DISABLEADVTSHORTCUTS in property and add 1 in value

How to check whether it is correct?

Click the start button?program files?go the installed application ?right click the application and go to properties and Target text box will be enabled now. Check this before and after this modification.

No comments: