Use Both Windows Installer and ClickOnce

From this link http://msdn2.microsoft.com/en-us/library/ms973805.aspx#clickoncevsinstaller_topic8 , I read the following, But I do not know steps/where to to create an Inifile. Please help me to create it. Thanks

Use Both Windows Installer and ClickOnce

Yes, that's right! You heard me correctly. Now that I've built a case for how different these two technologies are in their implementation, I am going to shake up your world by telling how you can use them together.

Windows Installer provides advanced capabilities for interacting with the user during an installation. Oftentimes, this is a critical step in the deployment process. The ability of an installation to interrogate the target system to ensure that it meets the minimum requirements of the application is critical. Additionally, most applications tend to have some interaction with the operating environment. This may include writing log files to disk, storing data in the registry, etc. A well-behaved application needs the opportunity to clean up this application-specific data when it is removed from the system. All of these are key deployment concepts missing from the ClickOnce paradigm.

In contrast, Windows Installer has an update and patching story, but it's not nearly as sleek and easy to manage as that of ClickOnce.

With a little thought, planning, and ingenuity, we can leverage both technologies to create a deployment model with the best of both worlds.

Designing the Windows Installer Setup

The basic concept here is to create an outer install based on Windows Installer technology. This outer install takes on the responsibility of inspecting and interrogating the system before the app is installed. It can interact with the user and gather and store configuration information, install shared assemblies to the GAC, and so forth. At uninstall time, it takes on the responsibility of cleaning up resources that ordinarily would have been left behind by our application. For example, it can uninstall files, delete log files create at runtime, uninstall services, remove assemblies from the GAC, and so on.

Plugging our ClickOnce application into our install is again a fairly simple task. Since ClickOnce apps can be activated via an Internet or intranet URL, we can simply create a shortcut on the target system that points to the application manifest. To accomplish this, we can use Windows Installer to create a .url file on the fly at install time. A .url file is a special type of shortcut that complies with the standard .ini file format.

[InternetShortcut]
URL=http://www.myserver.com/myapp/v1_0/myapp.application

Using Windows Installer to create this INI file, we only need to add a single row to the IniFile table.

Column Name Value Notes
IniFile URLShortcut1 Primary key
FileName My App.url The name of the .url file. The main part of this name is what the user will see. In this case, the shortcut will display "My App".
DirProperty MyShortcutFolder The primary key name of a directory defined in the install. This identifies the location where the shortcut will be created.
Section InternetShortcut The main section being written into the ini file.
Key URL Key portion of the key/value pair.
Value http://www.myserver.com/myapp/v1_0/myapp.application The actual URL to the application manifest.
Action 0 A value of 0 indicates that the value should be created or updated if it already exists.
Component MyComponent A reference to the component that is responsible for the install/uninstall of our shortcut.

A well-designed implementation of this technique will require further modifications to our msi file to ensure our installation is accomplishing all the tasks required by our application, but I hope this has provided you a glimpse of what is possible when you leverage the best parts of each deployment technology.

Conclusion

For applications that aren't restricted by their functional limitations, ClickOnce is an excellent deployment technology that provides valuable benefits and an updating model that was previously available only to Web-based applications. For applications with more sophisticated requirements, Windows Installer remains the deployment technology of choice. Each of these deployment technologies shares the common goal of reliably installing your application, but the similarities end there. You can be sure that the capabilities of ClickOnce will grow in the future, but you can be equally sure that Windows Installer is here to stay. In the meantime, get creative and learn to love them both!



Answer this question

Use Both Windows Installer and ClickOnce

  • Amadrias

    Hi, I too struggling since couple of days to enjoy the best of two world! What the hoang2th suggested, I did follow all the steps. In target directory after installation I am successfully getting the internetshortcut url file too. But I have following doubts:

    Firstly, it appears that to update the latest version of the app, user need to open this url file "Manually" , which is I think defeating the advantage of ClickOnce; i.e. "AUTOUPDATION". So my query is how can I achieve the auto updation feature using both technchology together.

    -- I mean is there is any way to open this url file automatically, which in turn run the publish.htm file

    Secondly, it appears that if manually run this url file (indirectly) publish.htm file, when I clicked on Install button on this page, it creates another (separate) entity of the application in my start up program!

    -- Why it's doing so Am doing some mistakes Please help me by giving the details or it would be really appreciated if you or anybody on this universe :) give me step by step procedure.

    Looking forward to lightening fast responses to this query.

    Thanks in advance!

    PS:Many thanks to hoang2th, at least following his/ her steps I reach to certain extent in this scenario!


  • Use Both Windows Installer and ClickOnce