Geeks With Blogs
Mark's Blog Another Subtext Powered Blog

For my first entry I would like to talk about ClickOnce.  It is a very cool technology allowing you to automatically update you Windows Forms application.  One feature that has been talked about is that you can add your own prerequisite to the application.  In fact there is even a tool that you can use to generate the manifests requires here: there is also an article about how to use it here:   I also learned how to do this process manually which is what I want to talk about in this post.

The first thing I did was create a standard Windows Installer for my application.  The application I tested this with was a Windows Forms application, but it could have been a Console Application.

Next I copied the application to a language subfolder to a subfolder of the BootStrapper folder.  The default location looks like this:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\(packagenamehere)\en

Inside this folder I have the MSI Installer I created and a new xml document called Package.xml.  Here is what my package.xml document looks like:

<?xml version="1.0" encoding="utf-8"?>

<Package xmlns=""  Name="HelloWorld" Culture="En">

                <PackageFiles CopyAllPackageFiles="false">

                                <PackageFile Name="HelloWorldSetup.msi"/>


                <Commands Reboot="Defer">

                                <Command PackageFile="HelloWorldSetup.msi" Arguments="">


                                                                <DefaultExitCode Result="Success" FormatMessageFromSystem="true"/>






You would just need to change the HelloWorld to what you named your application and MSI file (My MSI file is called HelloWorldInstaller).


There is only one more thing you need to do to make the prerequisite work.  You need another xml document in the folder one level up.  In my example the folder would be here:


C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\(packagenamehere)


This xml file is called Product.xml and it looks like this:


<?xml version="1.0" encoding="utf-8" ?>





Once again change the ProductCode to match the installer name.  That’s it.  When I go to publish a ClickOnce program, the HelloWorld prerequisite is available to me just like any other.


Posted on Wednesday, November 21, 2007 10:39 AM | Back to top

Comments on this post: How to add custom prerequisites to ClickOnce

# re: How to add custom prerequisites to ClickOnce
Requesting Gravatar...
This is the perfect solution to add the custom prerequisite to Visual studio 2005 for v2 and if you want to same for visual studio 2008 v3.5 then you need add the XML file to C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper location. And here is the Product.XML file.

<?xml version="1.0" encoding="utf-8" ?>

<DependsOnProduct Code="Microsoft.Windows.Installer.3.1" />

<PackageFile Name="QBFC7_0Installer.exe"/>

<MsiProductCheck Product="IsMsiInstalled"

<Command PackageFile="QBFC7_0Installer.exe" Arguments="">

<BypassIf Property="IsMsiInstalled" Compare="ValueGreaterThan" Value="0"/>
<FailIf Property="AdminUser" Compare="ValueNotEqualTo" Value="True"

<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" String="GeneralFailure"/>
Left by Sarbjit on Aug 28, 2008 4:08 AM

Your comment:
 (will show your gravatar)

Copyright © Mark Rosenberg | Powered by: