From MSI to WiX, Part 2 - ARP support, by Alex Shevchuk

來源:互聯網
上載者:User

標籤:

Following content is directly reprinted from From MSI to WiX, Part 2 - ARP support

 

Author: Alex Shevchuk

Adding Add/Remove Program (ARP) support

Subset of properties stored in the Property table defines the information operating system will show in Add/Remove Program Control Panel applet for the installed application.   

Here is the list of ARP-related properties:

  • ARPCOMMENTS
  • ARPCONTACT
  • ARPPRODUCTICON
  • ARPHELPLINK
  • ARPREADME
  • ARPURLINFOABOUT
  • ARPURLUPDATEINFO
  • ARPHELPTELEPHONE
  • ARPAUTHORIZEDCDFPREFIX
  • ARPSIZE
  • ARPINSTALLLOCATION

Some ARP properties will change the way how application can be updated:

  • ARPNOMODIFY
  • ARPNOREMOVE
  • ARPNOREPAIR
  • ARPSYSTEMCOMPONENT

Setting the ARPSYSTEMCOMPONENT property to 1 (actually, just having it in the Property table with any value) will hide the application from Add/Remove Programs.

Setting the ARPNOREMOVE property to 1 will hide or disable (on Windows 2000 and Windows XP) the Remove button in Add/Remove Programs.

Setting the ARPNOMODIFY property to 1 will disable the Modify (Change on Windows 2000) button in Add/Remove Programs.

Setting the ARPNOREPAIR property to 1 will disable the Repair button in Add/Remove Programs.

Because I don‘t want to clutter my main project file, I decided to put all ARP-related information in the separate include file (ControlPanel.wxi).  Here is the content of this file:

<Include>  <Property Id="ARPCOMMENTS" Value="Acme Corporation Comments" />  <Property Id="ARPCONTACT" Value="Put your name in here" />  <Property Id="ARPPRODUCTICON" Value="MainIcon.ico" />  <Property Id="ARPHELPLINK" Value="Your help link" />  <Property Id="ARPREADME" Value="Your README link" />  <Property Id="ARPURLINFOABOUT" Value="Your &apos;About&apos; information" />  <Property Id="ARPURLUPDATEINFO" Value="Your &apos;Update&apos; URL" />  <Property Id="ARPHELPTELEPHONE" Value="URL where users can find your support phone number" />  <Property Id="ARPAUTHORIZEDCDFPREFIX" Value="URL of the update channel for the application" />  <Property Id="ARPSIZE" Value="3" />  <!--  <Property Id="ARPNOMODIFY" Value="0" />  <Property Id="ARPNOREPAIR" Value="0" />  <Property Id="ARPNOREMOVE" Value="0" />  <Property Id="ARPSYSTEMCOMPONENT" Value="0" />  -->  <Icon Id="MainIcon.ico" SourceFile="MainIcon.ico" />  <!-- Set up ARPINSTALLLOCATION property -->  <CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />  <!-- Sequences -->  <InstallExecuteSequence>    <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"></Custom>  </InstallExecuteSequence></Include>

As you can see, in many cases, setting the value of the property is just simple declaration of the <Property> element, where Id attribute is set to the name of the property in the Property table and the Value attribute defines its value.

Situation is slightly more complicated when we set the product icon.  We need to add the <Icon> element and make sure that Id attribute of the <Icon> element has the same value as the Value attribute of the <Property> element with the Id attribute of ARPPRODUCTICON.  SourceFile attribute of the <Icon> element points to an actual icon file.

Even more complicated is setting the value of ARPINSTALLLOCATION property.  Because installation directory can be changed by the user either through user interface or command line, we can be sure about it only after installation path will be validated by the installer (more details about this process when we will talk about standard and custom actions).  To set the value of ARPINSTALLLOCATION property we need to create a record in the CustomAction table with the custom action which will set the value of ARPINSTALLLOCATION property to the value of INSTALLDIR property.  We also need to schedule this custom action to run after the standard InstallValidate action.

Here is the updated Minimal.wxs file:

<?xml version="1.0" encoding="UTF-8"?><Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">  <Product Id="{1EFFDCD2-4B4B-439E-8296-651795EE02D9}"                Name="Minimal Windows Installer Sample"                Language="1033"                Codepage="1252"                Version="1.0.0"                Manufacturer="Acme Corporation"                UpgradeCode="{15F9543C-1C8D-45D6-B587-86E65F914F20}">    <Package Id="{909A6CE7-2739-4522-92C2-03AD7D7EE4CD}"                    Description="Minimal Windows Installer Sample"                    Comments="This installer database contains the logic and data required to install Minimal Windows Installer Sample."                    InstallerVersion="200"                    Languages="1033"                    SummaryCodepage="1252"                    Platforms="Intel"                    ReadOnly="no"                    Compressed="yes"                    AdminImage="no"                    Keywords="Installer"                    ShortNames ="no"                    Manufacturer="Acme Corporation" />    <?include ControlPanel.wxi ?>    <Media Id="1" />    <Directory Id="TARGETDIR" Name="SourceDir">      <Directory Id="ProgramFilesFolder">        <Directory Id="INSTALLDIR" Name="Minimal" LongName="MinimalInstallation">          <Component Id="Component1" Guid="{A77C5B06-132D-4884-8E17-EA10A83C812D}">            <CreateFolder />          </Component>        </Directory>      </Directory>    </Directory>    <Feature Id="Feature1"                  Title="Feature1 title"                  Description="Feature1 description"                  Level="1"                  ConfigurableDirectory="INSTALLDIR" >      <ComponentRef Id="Component1" />    </Feature>  </Product></Wix>

Install it and take a look at the ARP properties for our package.

Whats next

Next time we‘ll take a look at the application search and launch conditions.

 

From MSI to WiX, Part 2 - ARP support, by Alex Shevchuk

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.