Web PI Extensibility: Custom Feeds – Installing Custom Products

As it was already mentioned in several articles about Web Platform Installer (Web PI), version 2 RTW of the product now offers extensibility as a part of its new set of features. Now, users can not only add additional Media and Developer Tools scenarios with a set of products not offered in Web PI by default, but also define and install their own products through Web PI. To add a new product to Web PI UI interface, you need to create a custom feed with some information for Web PI to parse and be able to display and later install products offered by your feed.

To make a product show up in the UI, you will need to define a new Web PI tab, pillar and product entities in the feed.

Here is sample XML that defines a Sample Product with a unique SampleProduct productId, that is grouped by Sample Products product family and put into a newly defined Sample Tab. Please note that you have to define a new custom tab for your custom products, since they cannot to be added to Web PI core tabs.

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

<feed xmlns="http://www.w3.org/2005/Atom">
  <version>1.0.0</version>
  <title>Sample Product WebPI v2 RTW Feed</title>
  <link href="http://www.contoso.com/SampleProductFeed.xml" />
  <updated>2009-9-29T16:30:00Z</updated>
  <author>
    <name>Sample Product Builder</name>
    <uri>http://www.contoso.com</uri>
  </author>
  <id>http://www.contoso.com/SampleProductFeed.xml</id>

  <entry>
    <productId>SampleProduct</productId>
    <title>Sample Product</title>

    <summary>Just summary</summary>
    <longSummary>Long summary of SampleProduct</longSummary>
    <productFamily>Sample Products</productFamily>

    <version>1.0.0</version>
    <images>
      <icon>c:\SampleProductIcon.png</icon>
    </images>
    <author>
      <name>Sample Product Builder</name>
      <uri>http://www.contoso.com</uri>
    </author>
    <published>2009-9-29T12:30:00Z</published>
    
    <!-- How can WebPI know your product is installed? -->
    <discoveryHint>
      <or>
        <!-- 1. Through registry (version value should be 1.0.0, if dont care about the verion, should be just keypath) -->
        <discoveryHint>
          <registry>
            <keyPath>HKEY_LOCAL_MACHINE\SOFTWARE\SampleProduct\Sample Product Version 1.0.0</keyPath>
            <valueName>Version</valueName>
            <valueValue>1.0.0</valueValue>
          </registry>
        </discoveryHint>
        <discoveryHint>
          <file>
            <!-- 2. Through filepath - if the exe is at this location, WebPI will know that SampleProduct is installed -->
            <filePath>%ProgramFiles%\SampleProduct\SampleProduct.exe</filePath>
          </file>
        </discoveryHint>
      </or>
    </discoveryHint>

    <!-- 
         What products need to be installed first? 
         Define dependencies through ProductId property of products
         declared in the main WebProductList file or other previously 
         added feeds 
    -->
    <dependency>
      <productId>IISManagementConsole</productId>
    </dependency>

    <!-- SampleProduct cannot be installed if product IncompatibleSampleProduct is already installed -->
    <incompatibilities>
      <incompatibleProduct>
        <productId>IncompatibleSampleProduct</productId>
      </incompatibleProduct>
    </incompatibilities>

    <!-- 
         installers and installer commands. Here you can define separate installers for
         different architectures, OSes, SKUs and languages
    -->
    <installers>
      <!-- x86 architecture installer -->
      <installer>
        <!-- installer Id should be unique for every SampleProduct installer -->
        <id>1</id>

        <!-- language of installer is English -->
        <languageId>en</languageId>

        <architectures>
          <x86 />
        </architectures>

        <!-- 
             list of OSes and SKUs this product can be installed on. On every OS/SKU that is not 
             supported, the product will not display 
        -->
        <osList>
          <os>
            <!-- the product is supported on Vista/Windows Server SP1 + -->
            <minimumVersion>
              <osMajorVersion>6</osMajorVersion>
              <osMinorVersion>0</osMinorVersion>
              <spMajorVersion>0</spMajorVersion>
            </minimumVersion>

            <!-- list of SKUs -->
            <osTypes>
              <Server />
              <HomePremium />
              <Ultimate />
              <Enterprise />
              <Business />
            </osTypes>
          </os>
        </osList>

        <!-- before the user will install the product, the link to the following EULA will be presented -->
        <eulaURL>http://www.contoso.com/eula.html</eulaURL>

        <!-- this info is important for WebPI to verify that the downloaded file was not tampered -->
        <installerFile>
          <!-- size in KBs -->
          <fileSize>1024</fileSize>
          <installerURL>http://www.contoso.com/SampleProduct_x86.msi</installerURL>
          <sha1>111222FFF000BBB444555EEEAAA777888999DDDD</sha1>
        </installerFile>

        <!-- how should WebPI install your product? -->
        <installCommands>
          <msiInstall>
            <msi>%InstallerFile%</msi>
          </msiInstall>
        </installCommands>
      </installer>

      <!-- x64 architecture installer -->
      <installer>
        <!-- installer Id should be unique for every SampleProduct installer -->
        <id>2</id>

        <!-- language of installer is English -->
        <languageId>en</languageId>

        <architectures>
          <x64 />
        </architectures>

        <osList>
          <os>
            <!-- the product is supported on Vista/Windows Server SP1 + -->
            <minimumVersion>
              <osMajorVersion>6</osMajorVersion>
              <osMinorVersion>0</osMinorVersion>
              <spMajorVersion>0</spMajorVersion>
            </minimumVersion>

            <!-- list of SKUs -->
            <osTypes>
              <Server />
              <HomePremium />
              <Ultimate />
              <Enterprise />
              <Business />
            </osTypes>
          </os>
        </osList>

        <!-- before the user will install the product, the link to the following EULA will be presented -->
        <eulaURL>http://www.contoso.com/eula.html</eulaURL>

        <!-- this info is important for WebPI to verify that the downloaded file was not tampered -->
        <installerFile>
          <!-- size in KBs -->
          <fileSize>1024</fileSize>
          <installerURL>http://www.contoso.com/SampleProduct_64.msi</installerURL>
          <sha1>111222FFF000BBB444555EEEAAA777888999DDDD</sha1>
        </installerFile>

        <!-- how should WebPI install your product? -->
        <installCommands>
          <msiInstall>
            <msi>%InstallerFile%</msi>
          </msiInstall>
        </installCommands>

      </installer>
    </installers>
  </entry>

  <!-- define a tab that contains SampleProduct -->
  <tabs>
    <tab>
      <pillarTab>
        <id>SampleTab</id>
        <name>Sample Tab</name>
        <description>My sample tab for my sample product</description>
        <pillar>
          <id>SampleProduct</id>
          <name>Sample Pillar</name>
          <description>Install sample product</description>
          <groupingId>SampleProductFamilyGrouping</groupingId>
          <recommended>
            <productId>SampleProduct</productId>
          </recommended>
        </pillar>
      </pillarTab>
    </tab>
  </tabs>

  <groupings>
    <grouping>
      <id>SampleProductFamilyGrouping</id>
      <!-- combine products based on their productFamily attributes -->
      <attribute>productFamily</attribute>
      <include>
        <item>Sample Products</item>
      </include>
    </grouping>
  </groupings>
</feed>


You can get a hash of your product, by using a free utility called File Checksum Integrity Verifier (FCIV) and running fciv.exe –sha <path to your file> from the command prompt.

To add a product from this feed to Web PI, save this text to an xml file. Then, go to the Options dialog (click Options link on the main window) and type the location of the xml file into the text box, click “Add feed” and close the dialog. You will see a new tab called “Sample Tab” that contains the grouping with the product – all defined in the xml above.

Below is a drill down of how your feed data is represented in the UI. The first screenshot shows how Web PI interprets tab and pillar feed elements.

image

To see how tabs group products based on their productFamily element, click on “Customize” link. The “Sample Products” group box represents a grouping by productFamily, to which Sample Product belongs. All other products with the same productFamily element would be grouped in the same group box.

image 


To see product details, click on the small “i” icon next to the product title. Finally, the product details page shows all the details defined for the product itself. To install Sample Product, check “Install Sample Product” and click Install. Web PI will select an installer based on the current machine architecture and the language of the current UI culture (if such is available).

image

Note that the feed refers to an icon located at my local path c:\SampleProductIcon.png, the feed is also added from a physical location c:\SampleProduct.xml. Most likely, you will want to host this content somewhere and refer to it through URLs. Your feed is ready to go – you can publish it and let other people install your product through Web PI. Enjoy!

9 Comments

  • Unfortunately, currently there are no APIs in Microsoft.Web.PlatformInstaller.dll to create custom feeds. You can take existing feeds - main product/application feeds and custom feeds published in this and other blogs and edit them manually. It'd be a nice feature to consider for Web PI v3! Thank you for your feedback

  • Hello, Kateryna!

    Thanks for post.

    What the license for Web PI v3 API (Microsoft.Web.PlatformInstaller.dll)?
    Can i use it for commercial purposes? Where i can read the license?

    Thank you!

  • Doesn't seem like you can use it for commercial purposes (see the license terms here: http://www.microsoft.com/web/webpi/eula/webpi.html)

  • Just to be sure what I meant: you cannot distribute Microsoft.Web.PlatformInstaller.dll with your product, but you might be able to provide a link to a Web PI page, from where it can be downloaded (the dll will be GAC'ed), so that the user can accept the Web PI EULA (important step) before installing your product.

    If you could describe yoru requirements and specifics of what you are trying to accomplish, I can give you a more definite answer.

  • Ok. Thanks!

  • Hello Kateryna,

    I'm creating a custom feed and the installer for my application is a cmd line that uses msdeploy. I need to pass some parameters like Virual Directory name (for creating it) and App Pool name through Web PI UI. Is that possible?

    The idea is to provide those parameters using Web PI and call the cmd line defined in the custom feed using those parameters.

    Thanks in advance,

  • Hello Kateryna,

    Good post and great product! Please take a look how we use custom feeds to install our solutions: http://www.helicontech.com/zoo/

    And I have a question - Is there/will be a way to add custom feed form the code, instead of asking user to click Options, put some URL in the filed and then click OK?

    Thanks!

  • @azumelzu: Is there a reason why you want to to call Web Deploy from the cmd line to install your app instead of Web PI doing it? Web PI actually uses Web Deploy APIs to install all applications.

  • @slov: Nice utilization of Web PI extensibility! I skimmed through your feed, it looks good. A couple of things I noticed:

    1. You use hard-coded C:\ in a discoveryHint.filePath in a couple of places. It is better to use %SystemDrive% instead like you do in a couple of other places

    2. Is there a reason you use the following InstallCommands in Perl_FCGI product


    %windir%\system32\cmd.exe
    /c &quot;%InstallerFile%&quot;



    instead of usual



    %InstallerFile%



    In case of msiInstall element, Web PI will pass standard parameters to make the install quite and save logs (and therefore links to logs on the final summary page), which you won't get in your case.

    Unfortunately, there is no way to automatically add a custom feed to Web PI UI. This was done for security reasons. However, you can use WebPICmdLine to automatically load and install products from a custom feed. Actually, you can completely automate installations with this tool.

    Hope this helps.

Comments have been disabled for this content.