The term Smart Client was coined to highlight the differences between the typical "Rich Client" applications of yesteryear and the next generation of client applications. Smart Client applications can be deployed and updated from a Centralized web server. Once deployed, smart client software applications can automatically update themselves to the latest version of the software that resides on the centralized server. We can implement this functionality in any Project in two different ways:
- Using Microsoft's Updater Applications Block
- ClickOnce deployment technique provided in VS.NET 2005
1) Updater Application Block
Microsoft's application blocks: "Updater Application Block" is used for the above purposes but using this, we have some limitations like:
- The block relies on absolute path links being provided in the configuration file. This reliance causes big problems, because you can't always guarantee that users will install your application to a specific location.
- When you want to add a new file to be updated, you have to modify a manifest file to set the file path for each file.
- A version is a set of files. So, if you want to update just one file you have to prepare a new update folder with a new manifest.
The above limitations can be removed by extending the updater block with the interface
IDownloader but the other problem with the Updater application block is that it only supports .NET 1.1 Frameworks, i.e. the framework .NET 1.1 must be installed on the machines. Even if .NET 1.1 Framework is present on the system, it can't be used for .NET 2.0 applications because it doesn't supports the machine.config file settings on the machine/system.
ClickOnce is a deployment technology that enables self-updating Windows-based applications that can be installed and run with minimal user interaction. ClickOnce deployment overcomes three major issues inherent in deployment:
- Difficulties in updating applications. With Microsoft Windows Installer deployment, whenever an application is updated, the user must reinstall the entire application; with ClickOnce deployment, you can provide updates automatically. Only those portions of the application that have changed are downloaded, then the full, updated application is reinstalled from a new side-by-side folder.
- Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications.
- Security permissions. Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment allows non-administrative users to install and grants only those Code Access Security permissions necessary for the application.
The core ClickOnce deployment architecture is based on two XML manifest files: an application manifest and a deployment manifest.
The application manifest describes the application itself, including the assemblies, the dependencies and files that make up the application, the required permissions, and the location where updates will be available. The application developer authors the application manifest by using the Publish Wizard in Visual Studio 2005 or the manifest generation tool (Mage.exe) in the .NET Framework SDK.
The deployment manifest describes how the application is deployed, including the location of the application manifest, and the version of the application that clients should run. An administrator authors the deployment manifest using the manifest generation tool (Mage.exe) in the .NET Framework SDK.
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 using the Publish Wizard; additional properties related to publishing are available on the Publish page of the Project Designer or you can publish the application on the server manually.
To Publish to Web Using Publish Wizard
- In Solution Explorer, select the application project.
- Right-click the project node and choose Publish. The Publish Wizard appears.
- On the Where do you want to publish the application? page, enter a valid URL using the format http://localhost/foldername, then click Next.
- In the Will the application be available offline? page, click the appropriate option:
- If you want to enable the application to be run when the user is disconnected from the network, click Yes, this application will be available online or offline. A shortcut on the Start menu will be created for the application.
- If you want to run the application directly from the publish location, click No, this application is only available online. A shortcut on the Start menu will not be created. Click Next to continue.
- Click Finish to publish the application.
Publishing status is displayed in the status notification area of the taskbar.
To Publish the application manually on Web Server
To publish your application on the Web Server without using the publish wizard is little bit tricky. For this, please follow the steps given below:
- Please create one folder under wwwroot folder for example YourClickOnceApplication.
- Create one subfolder under YourClickOnceApplication,
for example YourClickOnceApplication _1_0_0_0 since first time you are publishing application.
- Copy your .exe, .dlls, resource files\folders & config files from bin\Release folder into YourClickOnceApplication _1_0_0_0.
- Go to Start-->Program-->Microsoft .NET Framework SDK v2.0-->SDK Command Prompt & type MageUi.exe one window will open
- Create a new application manifest by selecting File, New, Application Manifest from the menu.
- On the default Name tab, enter the name and version number of this deployment.
- Select the Files tab and click the Browse... button next to the Application Directory text box.
- Select the directory containing your application files that you created in step 2, and click OK on the folder selection dialog box.
- Click the Populate button to add all your application files to the file list. If your application contains more than one executable file, mark the main executable file for this deployment as the startup application by selecting Entry Point from the File Type drop-down list. (If your application only contains one executable file, MageUI.exe will mark it automatically for you.)
- Select the Permissions Required tab and select the level of trust you need your application to assert. The default is Full Trust, which will be suitable for most applications.
- Select File, Save from the menu, and save the application manifest. You will be prompted to sign the application manifest when you save it. Save it in folder created in step 2 (i.e. under YourClickOnceApplication _1_0_0_0 folder).
- Select File, New, Deployment Manifest from the menu to create your deployment manifest, and then on the Name tab, supply a name and version number (188.8.131.52 in this example).
- Select the Publisher tab, and supply values for Publisher and Product. (Product is the name given to your application on the Windows Start menu when you install your application locally.)
- Switch to the Deployment tab, select the Application type as Install locally and give the URL of the virtual directory which you have created in step1 named
YourClickOnceApplication like here you can give http://localhost/ YourClickOnceApplication/YourAppName.application.
- Switch to the Update tab, and specify how often you would like this application to update. If your application uses the ClickOnce Deployment API to check for updates itself, clear the check box labelled this application should check for updates if not check the checkbox Also you can define the way your application will self update.
- Switch to the Application Reference tab. You can pre-populate all of the values on this tab by clicking the Select Manifest button and selecting the application manifest you created in the step 9.
- Choose Save and save the deployment manifest to disk. You will be prompted to sign the application manifest when you save it. Save deployment manifest in folder created in step 1 (i.e. under YourClickOnceApplication folder).
That's it. Now browse .application file from location given in step 12 for example.
Now the next time when you will publish your applications' new version, what you have to do is create a folder named YourClickOnceApplication _2_0_0_0 and put your new EXE, DLLs all other files and again create the application manifest file for this folder using mageui tool. Again you have to change the reference of application manifest file in the deployment manifest file. To do this, just open the deployment manifest file using mageui tool created in step 10 and change the application manifest path in Application Reference tab and save the file in the same location.
Now when you will run your application, it will ask that a new version is updated on server and whether you want to install or not. If you say yes, then it will download all the latest files from the server and reinstall the application on your system.