Thursday, July 4, 2013

Create Patch to upgrade windows application in .Net

Question?


I develop one .net win application (vs 2008) &  installed on client machine. Now i want to provide patch facility. So that already installed application will be updated by new patch. So i want to create patch file. but i am not able to create patch.


Summary

Today, in the world of software development, it is common to have patch releases due to various reasons. This article intends to make this process easier by explaining the steps that would be needed to create a patch using MSI 3.0.

 

Introduction:

I found myself wondering how to create patches for my application. I looked at several third-party tools like Wise and InstallShield and some freeware installers and found that they were all overkill for what I needed. My distribution needs were simple, but my projects were large. I clearly needed a way to easily create patches.
The VS.NET deployment project is very easy to use, much easier than working with the Windows Installer SDK directly. This ease of use comes at a cost; VS.NET deployment projects eliminate many of the features and flexibility of the SDK in order to simplify the build process.

Before You Go Ahead:

            First of all check the Microsoft Platform SDK is installed or not on your machine. If not then,
            1) Install the Microsoft Platform SDK.  
            2) Install Orca.Msi located at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
 
            After that check the version no. of already installed   application on client machine through control panel or just open your application code in visual studio & check the version no. property of the setup project. Let see the below Figure 1.

Figure 1. Properties of the setup folder as seen in VS.NET.

                                  
Process:

            To create the patch, there are several steps to be followed. This article walks you through the step of creating patch. First, create only a Windows forms application changes using VS.NET
            Make sure that there isn't any changes at database level. Because this patch update only application changes not database changes.
            After completion of changes at application level, open the property window of the setup project from VS.NET & change the version No. property as 1.0.1 as shown in Fig 2.


Figure 2. Properties of the setup folder as seen in VS.NET.



           
            On changing the version No, you would be prompted to change the product code and package code. Click on 'Yes' button these guids need to be changed when creating a patch; otherwise, an error would be thrown stating the GUID is not unique while creating the patch. The changed property would look as shown in Figure 2. Rebuild the project and after that rebuild the Setup project.
            After rebuild .msi file is created in your setup/Release or Setup/Debug folder. Open that .msi file with ORCA tool that u have already installed on your system. As shown in Fig 3.


                                      Figure 3. Open .msi file in Orca.


Follow the steps:

               1) Open Property table right click on Orca window & select add new row option. Add property name as ALLUSERS & it's value is 2. AS shown in Fig 4




                                                                   Figure 4

             2) Then change FolderFromAllusers propert value from Me  to ALL  and save changes.


                                                                            Figure 5
                             3) Open File table change already existing Version by this no. 65535.65535.65535.65535  as shown in Fig 6.


                                                              Figure 6.
       
                               4) Save all these changes in ORCA. Then run this .msi build on client system where old version application is already installed on syatem.

This creates the patch and can be installed as an upgrade to the previous release.  After completion of patch installation open your application & check new added changes will be  updated in your application. 


Conclusion :

 

Creating the patch is not an easy process, but once created, a patch release can be done; this was not available earlier. This makes it easier on the development teams as well as release managers if they need to make a hot fix immediately after a release.

3 comments: