<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Joy of Setup &#187; Windows Installer</title>
	<atom:link href="http://www.joyofsetup.com/tag/windows-installer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joyofsetup.com</link>
	<description>Bob Arnson on setup and servicing with WiX and MSI</description>
	<lastBuildDate>Wed, 01 Feb 2012 05:01:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting shelf space in the Store</title>
		<link>http://www.joyofsetup.com/2012/02/01/getting-shelf-space-in-the-store/</link>
		<comments>http://www.joyofsetup.com/2012/02/01/getting-shelf-space-in-the-store/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 05:01:28 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Etc]]></category>
		<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/?p=304</guid>
		<description><![CDATA[Reading the Windows Store for developers blog recently, I was pleasantly surprised to see that desktop (i.e., non-Metro-style) apps would be allowed to show up in the Windows Store. Desktop apps won&#8217;t get the same treatment as Metro-style apps, of &#8230; <a href="http://www.joyofsetup.com/2012/02/01/getting-shelf-space-in-the-store/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Reading the <a href="http://blogs.msdn.com/b/windowsstore/archive/2012/01/20/designing-the-windows-store-user-experience.aspx">Windows Store for developers blog</a> recently, I was pleasantly surprised to see that desktop (i.e., non-Metro-style) apps would be allowed to show up in the Windows Store. Desktop apps won&#8217;t get the same treatment as Metro-style apps, of course; instead of being able to install apps right from the Windows Store, desktop apps will have a similar listing page with a link to the developer&#8217;s site to handle download.</p>
<p>Still, it&#8217;s better than nothing &#8212; the Windows Store is likely to have a lot of window shoppers looking to buy apps.</p>
<p>However, a hurdle to get an app listing page is that the app must pass &#8220;certification.&#8221; In the past, this was known as the Windows Logo program and had many pages of technical requirements. In <a href="http://msdn.microsoft.com/library/windows/desktop/hh749939">Windows 8, the list is much smaller</a> and less prescriptive. For example, the Logo program for previous versions required the use of MSI, then required MSI or ClickOnce; for Windows 8, there are no technology restrictions.</p>
<p>Some requirements that struck me as interesting:</p>
<blockquote><p>1.2 Your app must not take a dependency on the VB6 runtime</p></blockquote>
<p>VB6, IE6 &#8212; anything v6 must go away. <img src='http://www.joyofsetup.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>5.1 Your app must properly implement a clean, reversible installation</p>
<p>If the installation fails, the app should be able to roll it back and restore the machine to its previous state.</p></blockquote>
<p>If Windows 8 certification is anything like previous versions&#8217;, it will involve automated test suites that will highlight rollback that&#8217;s less than perfect.</p>
<blockquote><p>5.4 Your app must never block silent install/uninstall</p></blockquote>
<p>So don&#8217;t throw UI from custom actions and don&#8217;t rely on being able to prompt the user (i.e., also don&#8217;t break requirement #5.1).</p>
<blockquote><p>6.1 All executable files (.exe, .dll, .ocx, .sys, .cpl, .drv, .scr) must be signed with an Authenticode certificate</p></blockquote>
<p>MSI packages aren&#8217;t mentioned. But if you ship a Burn bundle or other bootstrapper .exe, that&#8217;s going to require signing.</p>
<blockquote><p>10.1 Your app must be installed in the Program Files folder by default</p></blockquote>
<p>There&#8217;s nothing mentioned that would exempt per-user apps in general from this requirement, though you can always request exceptions. Given the emphasis Metro places on per-user, restricted apps, perhaps this requirement will be extended/relaxed for per-user desktop apps too.</p>
<blockquote><p>10.6 Your app must write user data at first run and not during the installation in “per-machine” installations</p></blockquote>
<p>Long-time readers of <a href="http://wix.sourceforge.net/mailinglists.html#wix-users">wix-users</a> will recognize this as advice given again and again. Good to see Windows catching on. <img src='http://www.joyofsetup.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>10.7 Exceptions and Waivers</p>
<p>A waiver is required for apps that write to the global assembly cache (GAC) .NET apps should keep assembly dependencies private, and store it in the app directory unless sharing an assembly is explicitly required.</p></blockquote>
<p>I suspect it&#8217;s a response to the GAC getting used too often when it&#8217;s not needed or very useful. (See also Rico Mariani&#8217;s <a href="http://blogs.msdn.com/b/ricom/archive/2012/01/31/ngen-or-not-the-rules-haven-t-changed-very-much-since-2004.aspx">blog post on using NGen</a>, which falls into the same boat.) Still, I&#8217;m mildly surprised to see it a requirement.</p>
<blockquote><p>12.5 App running under the WoW64 emulator should not attempt to subvert or bypass Wow64 virtualization mechanisms</p></blockquote>
<p>This one&#8217;s interesting, depending how struct &#8220;subvert&#8221; turns out to be. For example, several WiX custom actions make fairly trivial &#8220;subversions&#8221; of WoW64 to avoid the need for both 32-bit and 64-bit custom actions just to write to the right version of Program Files.</p>
<p>All in all, there&#8217;s nothing terribly surprising in this set of requirements. A lot of them just codify what&#8217;s already known as best practice for Windows apps in the age of UAC. Of course, this is just the first version of the certification requirements and Windows 8 isn&#8217;t yet shipping; there&#8217;s plenty of time for Microsoft to add, drop, or change requirements. In the end, you get to decide whether the effort of certification is worth having a presence in the Windows Store. Remember the Metro-style app folks, who have no choice in the matter: The Windows Store is the only way they can ship.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2012/02/01/getting-shelf-space-in-the-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Same as it ever was</title>
		<link>http://www.joyofsetup.com/2011/09/15/same-as-it-ever-was/</link>
		<comments>http://www.joyofsetup.com/2011/09/15/same-as-it-ever-was/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 20:32:46 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/?p=282</guid>
		<description><![CDATA[Microsoft&#8217;s BUILD conference is going on this week and it&#8217;s chock full of new information about Windows 8 (or whatever they end up calling it). The biggest news is the new Metro-style application, which includes the AppX package format for &#8230; <a href="http://www.joyofsetup.com/2011/09/15/same-as-it-ever-was/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Microsoft&#8217;s <a href="http://www.buildwindows.com/">BUILD conference</a> is going on this week and it&#8217;s chock full of new information about Windows 8 (or whatever they end up calling it). The biggest news is the new Metro-style application, which includes the AppX package format for installing them.</p>
<p>There are three primary buckets applications fall into in the brave new Windows 8 world:</p>
<ol>
<li>Metro-style</li>
<li>Windows 8 non-Metro-style</li>
<li>&#8220;Retro-style&#8221; (aka legacy, anything created before 2011)</li>
</ol>
<p>Metro-style apps get all the goodies Windows 8 offers, including AppX packaging I&#8217;ll blog about. As <a href="http://robmensching.com/blog/posts/2011/9/13/Setup-in-Windows-8-and-Visual-Studio">Rob describes</a>, deployment is a first-class citizen in Windows 8. Apps in the other two buckets have the exact same options they have in Windows 7. And by exact, I mean &#8220;really, almost exactly 100 percent.&#8221;</p>
<h2>No soup for you</h2>
<p>As is its wont, rather than fixing the weaknesses of its existing platform, Microsoft replaced it with an all-new platform with a different set of weaknesses. Naturally, Windows 8 still includes Windows Installer. But if you were hoping for some of the same deployment love for your non-Metro-style apps that the Windows team showered on Metro-style apps, I&#8217;m sorry to disappoint: For better or worse, Windows 8&#8242;s MSI is functionally identical to Windows 7&#8242;s MSI v5.0.</p>
<p>A quick spelunking in the Windows 8 SDK available to MSDN subscribers reveals mostly structual changes to the MSI header files. For example, the _WIN32_MSI macro is defined as &#8220;500&#8243; for both Windows 7 and Windows 8:</p>
<pre style="padding-left: 30px;">#if (_WIN32_WINNT &gt;= 0x0601 || (defined(NTDDI_VERSION) &amp;&amp; NTDDI_VERSION &gt;= NTDDI_WIN8))
 #define _WIN32_MSI   500
#elif (_WIN32_WINNT &gt;= 0x0601 || (defined(NTDDI_VERSION) &amp;&amp; NTDDI_VERSION &gt;= NTDDI_WIN7))
 #define _WIN32_MSI   500</pre>
<p style="padding-left: 30px;">The only addition is a new MSIARCHITECTUREFLAGS value in Msi.h:</p>
<pre style="padding-left: 30px;">typedef enum tagMSIARCHITECTUREFLAGS
{
 MSIARCHITECTUREFLAGS_X86   = 0x00000001L, // set if creating the script for i386 platform
 MSIARCHITECTUREFLAGS_IA64  = 0x00000002L, // set if creating the script for IA64 platform
 MSIARCHITECTUREFLAGS_AMD64 = 0x00000004L, // set if creating the script for AMD64 platform
 MSIARCHITECTUREFLAGS_ARM   = 0x00000008L //set if creating the script for ARM platform
}MSIARCHITECTUREFLAGS;</pre>
<p>and a new property name in MsiDefs.h:</p>
<pre style="padding-left: 30px;">#define IPROPNAME_ARM              TEXT("Arm")</pre>
<p>As we&#8217;ve known for a while that Windows 8 will support the ARM architecture, its presence isn&#8217;t too surprising.</p>
<p>There are no other new enumeration values. There are no new MSI API functions. While it&#8217;s possible there are, for example, new standard actions that wouldn&#8217;t have visible impact in the header files, I don&#8217;t find it too likely.</p>
<p>That yields two tiny bits of good news:</p>
<ol>
<li>Lack of visible interface changes probably means a lack of visible behavior changes. That likely means that your Retro-style installers will probably work without change, or at least as well as the classic Windows 8 desktop supports Retro-style apps.</li>
<li>WiX and Burn won&#8217;t need to do anything to support Windows 8. OK, that&#8217;s something only a few of us need to worry about&#8230;</li>
</ol>
<p>Coming up: More about Metro-style deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2011/09/15/same-as-it-ever-was/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSI v5.0 features in WiX v3.0</title>
		<link>http://www.joyofsetup.com/2009/01/17/msi-v50-features-in-wix-v30/</link>
		<comments>http://www.joyofsetup.com/2009/01/17/msi-v50-features-in-wix-v30/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 02:27:56 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[WiX]]></category>
		<category><![CDATA[WiX highlights]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/2009/01/17/msi-v50-features-in-wix-v30/</guid>
		<description><![CDATA[MSI 5.0 ships in the recently released Windows 7 beta. When the Windows 7 beta SDK was released, Rob and I had the detailed information we needed to add support for those features in WiX. A week and a day &#8230; <a href="http://www.joyofsetup.com/2009/01/17/msi-v50-features-in-wix-v30/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>MSI 5.0 ships in the recently released <a href="http://www.joyofsetup.com/2009/01/07/windows-7-server-2008-r2-betas-now-available-on-msdn/">Windows 7 beta</a>. When the <a href="http://www.joyofsetup.com/2009/01/13/windows-7-beta-sdk-now-available/">Windows 7 beta SDK was released</a>, Rob and I had the <a href="http://msdn.microsoft.com/en-us/library/dd408114(VS.85).aspx">detailed information</a> we needed to add support for those features in WiX. A week and a day later, <a href="http://www.joyofsetup.com/2009/01/17/highlights-of-wix-v3049170/">WiX v3.0.4917.0</a> includes that support.</p>
<h2>What&#8217;s new?</h2>
<ul>
<li>In a long-awaited nod to modern UIs, MSI 5.0 supports a <a href="http://msdn.microsoft.com/en-us/library/dd407936(VS.85).aspx">hyperlink control</a>. In WiX authoring, the hyperlink control using &quot;Hyperlink&quot; as the <a href="http://wix.sourceforge.net/manual-wix3/wix_xsd_control.htm">Control/@Type attribute</a>:<br />
<blockquote>
<p>&lt;Control Id=&quot;MyHyperlinkControl1&quot; Height=&quot;20&quot; Width=&quot;100&quot; Type=&quot;Hyperlink&quot; X=&quot;5&quot; Y=&quot;5&quot;&gt;          <br />&#160; &lt;Text&gt;&lt;![CDATA[&lt;a href=&quot;<a href="http://www.joyofsetup.com/&quot;">http://www.joyofsetup.com/&quot;</a>&gt;Joy of Setup&lt;/a&gt;]]&gt;&lt;/Text&gt;           <br />&lt;/Control&gt;</p>
</blockquote>
</li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd408010(VS.85).aspx">MsiPrint control event</a> supports printing a rich-edit control, much like the WixUI support for printing the license agreement. </li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd408008(VS.85).aspx">MsiLaunchApp control event</a> launches an installed file, like the <a href="http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm">WixShellExec custom action</a>. </li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd408039(VS.85).aspx">MsiShortcutProperty table</a> supports adding properties to shortcuts. WiX exposes this functionality with ShortcutProperty elements as children of the <a href="http://wix.sourceforge.net/manual-wix3/wix_xsd_shortcut.htm">Shortcut element</a>. </li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd408009(VS.85).aspx">MsiLockPermissionsEx table</a> supports a richer set of security settings, like WixUtilExtension&#8217;s <a href="http://wix.sourceforge.net/manual-wix3/util_xsd_permissionex.htm">PermissionEx element</a> and custom actions. WiX supports MsiLockPermissionsEx with a PermissionEx element in the WiX (not WixUtilExtension) namespace. <a href="http://msdn.microsoft.com/en-us/library/dd408009(VS.85).aspx">MsiLockPermissionsEx </a>and the new PermissionEx element use <a href="http://msdn.microsoft.com/en-us/library/aa379567%28VS.85%29.aspx">security descriptor definition language</a> (SDDL) to describe permissions. Both also support conditionally applying permissions. See <a href="http://msdn.microsoft.com/en-us/library/dd408053(VS.85).aspx">Securing Resources</a> for details. </li>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd408038(VS.85).aspx">MsiServiceConfig</a> and <a href="http://msdn.microsoft.com/en-us/library/dd408037(VS.85).aspx">MsiServiceConfigFailureActions</a> tables add service-configuration options, like WixUtilExtension&#8217;s ServiceConfig element and custom actions. WiX supports the tables with a ServiceConfig element that, like the PermissionEx element, is in the WiX namespace. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2009/01/17/msi-v50-features-in-wix-v30/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Chrome setup</title>
		<link>http://www.joyofsetup.com/2008/09/02/google-chrome-setup/</link>
		<comments>http://www.joyofsetup.com/2008/09/02/google-chrome-setup/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 04:48:35 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[best practices]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/2008/09/02/google-chrome-setup/</guid>
		<description><![CDATA[Google today released (after a bit of a comic-book&#160;pre-release, presumably due to the Labor Day holiday in the US) Google Chrome, its long-rumored open-source browser. Plenty of people will talk (endlessly) about the implications of another browser and how well &#8230; <a href="http://www.joyofsetup.com/2008/09/02/google-chrome-setup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Google today released (after a bit of a <a href="http://www.google.com/googlebooks/chrome/">comic-book</a>&#160;<a href="http://blogoscoped.com/google-blog.html">pre-release</a>, presumably due to the Labor Day holiday in the US) <a href="http://www.google.com/chrome/">Google Chrome</a>, its long-rumored open-source browser. Plenty of people will talk (endlessly) about the implications of another browser and how well Google Chrome and <a href="http://code.google.com/chromium/">Chromium</a> (the open source project) do the job. Blah, blah. Whatever. What&#8217;s <em>really </em>interesting is a couple of choices Google made about deployment:</p>
<ol>
<li>The Google Chrome <a href="http://www.google.com/chrome/eula.html">download</a> is a svelte 474K bootstrapper that downloads the setup bits. No offline installer is available (unless it&#8217;s well-hidden). </li>
<li>Google Chrome is a &quot;composite&quot; setup: The guts of the application are installed by a non-MSI self-extractor. However, Google Chrome <a href="http://blogoscoped.com/google-chrome/34">includes Google Gears</a>, the browser add-in/library that adds a <a href="http://code.google.com/apis/gears/gears_faq.html">bunch of functionality for making apps-in-the-browser more powerful</a>. The Gears in Google Chrome is installed by an MSI package. And yes, it&#8217;s built with WiX. </li>
<li>The Google Updater is no longer a LocalSystem service; instead, it starts at logon from the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run registry key. </li>
<li>Last and absolutely not least: Google Chrome is a per-user application. It even installs in the per-user LocalAppDataFolder. (The included Google Gears is marked as &quot;<a href="http://msdn.microsoft.com/en-us/library/aa372870(VS.85).aspx">UAC compliant</a>.&quot;) </li>
</ol>
<p>That Google Chrome is a per-user app is amazing. Even with UAC on Windows Vista and Windows Server 2008, it&#8217;s <em>so</em> easy to say that &quot;everyone&#8217;s used to needing admin privileges to install.&quot; That Google took the extra effort to limit themselves to the capabilities of a per-user app says a lot about their desire to have:</p>
<ul>
<li>a low-impact setup </li>
<li>and absolutely no barriers to entry. </li>
</ul>
<p>I wonder if it&#8217;s the start of a trend&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2008/09/02/google-chrome-setup/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Feature states in component conditions</title>
		<link>http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/</link>
		<comments>http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 05:58:29 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Windows Installer]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/</guid>
		<description><![CDATA[MSI has some funky syntax to support checking the action state (what MSI is planning to do during the current install transaction) and install state (what MSI already did, in a previous install transaction) of both features and components. See &#8230; <a href="http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>MSI has some funky syntax to support checking the <em>action state</em> (what MSI is planning to do during the current install transaction) and <em>install state</em> (what MSI already did, in a previous install transaction) of both features and components. See <a href="http://msdn2.microsoft.com/en-us/library/aa368012(VS.85).aspx">Conditional Statement Syntax</a> for the details and <a href="http://msdn2.microsoft.com/en-us/library/aa368561(VS.85).aspx">Examples of Conditional Statement Syntax</a> for some examples. (As an aside, would it have been too much to ask to avoid the Perl-like prefix characters and have something function-like such as FeatureActionState(featureId)?)</p>
<p>A couple of people on the <a href="https://lists.sourceforge.net/lists/listinfo/wix-users">wix-users</a> mailing list have asked about using the feature action state in component conditions. There’s good news and bad news.</p>
<h2>Good news for simple cases</h2>
<p>The good news is that in simple cases with simple conditions, there’s probably another way to get the behavior you’re looking for. For example, one component can be assigned to multiple features, so if you’re trying to install a component when any of several features are being installed, just reference the component in all the features. MSI will install the component once, regardless of how many features reference it.</p>
<h2>The bad news</h2>
<p>If you want to conditionalize a component based on whether a particular feature is being installed (i.e., its action state), you can’t rely solely on the component’s condition. The <a href="http://msdn2.microsoft.com/en-us/library/aa368007(VS.85).aspx">Component Table</a> doc has this to say:</p>
<blockquote><p>The Condition field enables or disables a component only during the <a href="http://msdn2.microsoft.com/en-us/library/aa368048%28VS.85%29.aspx">CostFinalize action</a>. To enable or disable a component after CostFinalize, you must use a custom action or the <a href="http://msdn2.microsoft.com/en-us/library/aa368322%28VS.85%29.aspx">DoAction ControlEvent</a> to call <a href="http://msdn2.microsoft.com/en-us/library/aa370383%28VS.85%29.aspx"><strong>MsiSetComponentState</strong></a>.</p></blockquote>
<p>The <a href="http://msdn2.microsoft.com/en-us/library/aa368048%28VS.85%29.aspx">CostFinalize action</a> doc says:</p>
<blockquote><p>The CostFinalize action queries the <a href="http://msdn2.microsoft.com/en-us/library/aa368014%28VS.85%29.aspx">Condition</a> table to determine which features are scheduled to be installed. Costing is done for each component in the Component table.</p></blockquote>
<p>Unfortunately, it doesn’t state explicitly that the order of the two sentences is the order of execution. But, even if it did, there’s this table in <a href="http://msdn2.microsoft.com/en-us/library/aa368012(VS.85).aspx">Conditional Statement Syntax</a>:</p>
<blockquote>
<h6>Feature and Component State Values</h6>
<p>The following table shows where it is valid to use the feature and component operator symbols.</p>
<table border="1" cellspacing="0" cellpadding="4" width="400">
<tbody>
<tr>
<td width="200" valign="top"><strong>Operator &lt;state&gt;</strong></td>
<td width="200" valign="top"><strong>Where this syntax is valid</strong></td>
</tr>
<tr>
<td width="200" valign="top">$component-action</td>
<td width="200" valign="top">In the <a href="http://msdn2.microsoft.com/en-us/library/aa368014%28VS.85%29.aspx">Condition</a> table, and in the sequence tables, after the <a href="http://msdn2.microsoft.com/en-us/library/aa368048%28VS.85%29.aspx">CostFinalize</a> action.</td>
</tr>
<tr>
<td width="200" valign="top">&amp;feature-action</td>
<td width="200" valign="top">In the Condition table, and in the sequence tables, after the CostFinalize action.</td>
</tr>
<tr>
<td width="200" valign="top">!feature-state</td>
<td width="200" valign="top">In the Condition table, and in the sequence tables, after the CostFinalize action.</td>
</tr>
<tr>
<td width="200" valign="top">?component-state</td>
<td width="200" valign="top">In the Condition table, and in the sequence tables, after the CostFinalize action.</td>
</tr>
</tbody>
</table>
</blockquote>
<p>So there are two fairly explicit strikes against being able to use a feature action state in a component condition:</p>
<ul>
<li><a href="http://msdn2.microsoft.com/en-us/library/aa368012(VS.85).aspx">Conditional Statement Syntax</a> doesn’t list the Component table as a valid place to use the &amp;feature-action syntax.</li>
<li>It says the syntax is valid only after CostFinalize but according to <a href="http://msdn2.microsoft.com/en-us/library/aa368007(VS.85).aspx">Component Table</a>, that’s too late to use the component condition to enable/disable the component.</li>
</ul>
<p>The <a href="http://msdn2.microsoft.com/en-us/library/aa368007(VS.85).aspx">Component Table</a> says to use a “custom action or the <a href="http://msdn2.microsoft.com/en-us/library/aa368322%28VS.85%29.aspx">DoAction ControlEvent</a> to call <a href="http://msdn2.microsoft.com/en-us/library/aa370383%28VS.85%29.aspx"><strong>MsiSetComponentState</strong></a>.” I haven’t quite deciphered whether the doc is saying to use DoAction to call a custom action from the UI or whether there’s a special, secret way of calling MsiSetComponentState via DoAction. If it’s the latter, I’m not aware of it (hence “special, secret”).</p>
<h2>Here be dragons</h2>
<p>Having been a writer for many years, I try to be nice about doc that is correct, even if in retrospect it’s not as helpful as it could have been. So here’s me being nice. The following sentence from <a href="http://msdn2.microsoft.com/en-us/library/aa368007(VS.85).aspx">Component Table</a> easily leads a trusting reader down the wrong path:</p>
<blockquote><p>The Condition column in the Component table accepts conditional expressions containing references to the installed states of features and components.</p></blockquote>
<p>So here we have a sentence that contradicts the table in <a href="http://msdn2.microsoft.com/en-us/library/aa368012(VS.85).aspx">Conditional Statement Syntax</a> and it’s really easy to misread the “installed state[s]” as “action states.” At the very least, it deserves clarification.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2008/04/09/feature-states-in-component-conditions/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Feature conditions and UI</title>
		<link>http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/</link>
		<comments>http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/#comments</comments>
		<pubDate>Thu, 31 May 2007 04:56:22 +0000</pubDate>
		<dc:creator>Bob Arnson</dc:creator>
				<category><![CDATA[Windows Installer]]></category>

		<guid isPermaLink="false">http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/</guid>
		<description><![CDATA[A question that&#8217;s come up on the wix-users mailing list several times lately has been about how to use feature conditions with properties set in the UI. It doesn&#8217;t work as most people expect so I thought I&#8217;d dig a &#8230; <a href="http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A question that&#8217;s come up on the <em></em><a href="http://sourceforge.net/mailarchive/forum.php?forum_name=wix-users">wix-users mailing list</a> several times lately has been about how to use feature conditions with properties set in the UI. It doesn&#8217;t work as most people expect so I thought I&#8217;d dig a little deeper than I would in a bunch of replies on the mailing list.</p>
<p>The basic idea is that you have some kind of optional functionality &#8212; like a Web site or Visual Studio integration &#8212; that you want the user to be able to enable or disable from the installer UI. (I&#8217;m assuming here that the functionality is in reality just a set of discrete components organized into a feature.)</p>
<p>The easiest way to get this working is to use MSI&#8217;s built-in <a href="http://msdn2.microsoft.com/en-us/library/aa371604.aspx">SelectionTree control</a> &#8212; the normal, boring, not-quite-easy-to-use feature tree that you see in most installers. That&#8217;s the approach we used with the WiX installer; in addition to features for plain sets of files, there are features for Visual Studio, Votive, and MSBuild integration.</p>
<p>The thrust of this question, though, is generally about using some other UI, like checkboxes or groups of radio buttons, to offer a better user experience during setup. But if you replace the SelectionTree control, you need to also replace how it manages feature states for you. <a href="http://msdn2.microsoft.com/en-us/library/aa368014.aspx">Feature conditions</a> seem like a fairly cheap way of accomplishing that, assuming you use public (i.e., all UPPERCASE) and secure (Property/@Secure=&#8221;yes&#8221;) properties to ensure they&#8217;re always passed to the MSI server for the installation execution sequence.</p>
<p>But it doesn&#8217;t work and as is usual with MSI, reading the SDK doc and examining a verbose log tell us why &#8212; almost.</p>
<p>Let&#8217;s start with the doc on the <a href="http://msdn2.microsoft.com/en-us/library/aa368014.aspx">Condition table</a>, which is the table where feature conditions are stored. A promising blurb:</p>
<blockquote><p>The Level may be set based on any conditional statement, such as a test for platform, operating system, or a particular property setting.</p></blockquote>
<p>A nice feature of the MSI SDK doc is that each table lists the actions that refer to the table. For the Condition table, it says:</p>
<blockquote><p>This table is referred to when the <a href="http://msdn2.microsoft.com/en-us/library/aa368048.aspx">CostFinalize action</a> is executed.</p></blockquote>
<p>Follow that link and you get another couple of interesting blurbs:</p>
<blockquote><p>The CostFinalize action must be executed before starting any user interface sequence which allows the user to view or modify <a href="http://msdn2.microsoft.com/en-us/library/aa368585.aspx">Feature</a> table selections or directories.</p></blockquote>
<p>and</p>
<blockquote><p>The CostFinalize action queries the <a href="http://msdn2.microsoft.com/en-us/library/aa368014.aspx">Condition</a> table to determine which features are scheduled to be installed.</p></blockquote>
<p>So far, everything sounds like it will work. It doesn&#8217;t, though, so clearly the docs aren&#8217;t telling the whole story. Verbose logs are our next step. Starting with MSI 3.1, they include entries when properties are added, changed, or deleted, so you can verify that the properties are being set correctly during the UI sequence. You can also verify that MSI is passing those properties to the execution sequence. Search the log for &#8220;Switching to server&#8221; to see the list of properties being passed. For example, from a complete install of the Windows Vista SDK version of Orca:</p>
<blockquote><p>MSI (c) (6C:24) [14:54:54:015]: Switching to server: CUBDIR=&#8221;C:\Program Files (x86)\Orca\&#8221; ORCADIRECTORY=&#8221;C:\Program Files (x86)\Orca\&#8221; TARGETDIR=&#8221;V:\&#8221; MS.51D569E0_8A28_11D2_B962_006097C4DE24=&#8221;C:\WINNT\SysWOW64\&#8221; MS.51D569E2_8A28_11D2_B962_006097C4DE24=&#8221;C:\WINNT\SysWOW64\&#8221; MS.7EBEDD6A_AA66_11D2_B980_006097C4DE24=&#8221;C:\WINNT\SysWOW64\&#8221; MS.7EBEDD3E_AA66_11D2_B980_006097C4DE24=&#8221;C:\WINNT\SysWOW64\&#8221; INSTALLLEVEL=&#8221;1000&#8243; COMPANYNAME=&#8221;MS&#8221; USERNAME=&#8221;Bob Arnson&#8221; CURRENTDIRECTORY=&#8221;X:\&#8221; CLIENTUILEVEL=&#8221;0&#8243; CLIENTPROCESSID=&#8221;3180&#8243; SOURCEDIR=&#8221;X:\&#8221; ACTION=&#8221;INSTALL&#8221; EXECUTEACTION=&#8221;INSTALL&#8221; ROOTDRIVE=&#8221;V:\&#8221; SECONDSEQUENCE=&#8221;1&#8243;  ADDLOCAL=OrcaHelp,Orca,EvalComServer,MergeModServer,CUBFiles,FullCUBFile,LogoCUBFile,XPLogoCUBFile,MMCUBFile</p></blockquote>
<p>Notice the <a href="http://msdn2.microsoft.com/en-us/library/aa367536.aspx">ADDLOCAL property</a> setting. It&#8217;s a comma-delimited list of feature names that are to be installed. I didn&#8217;t pick them individually; instead, I used the &#8220;complete&#8221; button to say I wanted everything. The orca.msi package publishes a <a href="http://msdn2.microsoft.com/en-us/library/aa371688.aspx">SetInstallLevel control event</a> with a high install level to let MSI decide to install all features rather than using an <a href="http://msdn2.microsoft.com/en-us/library/aa367537.aspx">AddLocal control event</a> to manually list them.</p>
<p>Let&#8217;s assume that MSI uses the ADDLOCAL property and its friends the <a href="http://msdn2.microsoft.com/en-us/library/aa371194.aspx">REMOVE</a> and <a href="http://msdn2.microsoft.com/en-us/library/aa367538.aspx">ADDSOURCE</a> properties (among other friends) to communicate to the MSI server the feature choices the user made during the UI sequence. If you think about the many different ways the UI can implicitly and explicitly set which features get installed &#8212; from &#8220;typical&#8221; and &#8220;complete&#8221; buttons publishing SetInstallLevel control events and SelectionTree controls letting users pick and choose individual features &#8212; it makes sense that MSI would need a rich way of controlling feature installation and it makes sense for MSI to use its own properties mechanism rather than invent a new one. (And note that the same thing applies to uninstallation and reinstallation &#8212; those are all handled on a per-feature basis via properties.)</p>
<p>OK, so what does that have to do with feature conditions? (I&#8217;m getting there, really.) All the feature-selection property topics have this blurb:</p>
<blockquote><p>The installer sets the <a href="http://msdn2.microsoft.com/en-us/library/aa370839.aspx">Preselected</a> Property to a value of &#8220;1&#8243; during the resumption of a suspended installation, or when any of the above properties are specified on the command line.</p></blockquote>
<p>Follow the Preselected link and you get this blurb:</p>
<blockquote><p>The <strong>Preselected</strong> property indicates that features have already been selected and that the selection dialog need not be shown.</p></blockquote>
<p>Now it&#8217;s time to enter the murky world of speculation. There&#8217;s no doc to indicate that the feature-selection properties or the Preselected property have any affect on feature-condition evaluation in CostFinalize. But I think it&#8217;s reasonable to infer that an explicit feature selection (via ADDLOCAL, for example) would override the more implicit feature-selection options available, including the Condition table and <a href="http://msdn2.microsoft.com/en-us/library/aa369536.aspx">INSTALLLEVEL property</a>.</p>
<p>And, to make a long story short &#8212; too late! &#8212; Carolyn, MSI Team Dev Lead, confirmed that&#8217;s the case. Feature conditions are evaluated only if no feature-selection properties are set. And, as the UI sequence converts SetInstallLevel control events, feature-selection control events, and SelectionTree control settings into the corresponding feature-selection properties, feature conditions that include properties set during the UI sequence won&#8217;t work as expected.</p>
<p>Note that an installation that doesn&#8217;t run the UI sequence (e.g., using the <a href="http://msdn2.microsoft.com/en-us/library/aa367988.aspx">/qb command-line switch</a> to run a basic-UI installation) can use properties set during the execute sequence in feature conditions. But the same caveat applies: If any feature-selection properties are set, feature conditions aren&#8217;t evaluated.</p>
<h2>OK, fine, what now?</h2>
<p>So how do you get this working? As I said near the beginning of this much-longer-than-expected tome, &#8220;if you replace the SelectionTree control, you need to also replace how it manages feature states for you.&#8221; As SelectionTree controls end up setting the feature-selection properties, you need to do the same thing, directly or indirectly. The easiest way is to publish feature-selection control events from your feature-selection dialog.</p>
<p>For example, the WixUI dialog set WixUI_Mondo uses SetInstallLevel published from SetupTypeDlg:</p>
<blockquote><p>&lt;Control Id=&#8221;CompleteButton&#8221; Type=&#8221;PushButton&#8221; X=&#8221;40&#8243; Y=&#8221;171&#8243; Width=&#8221;80&#8243; Height=&#8221;17&#8243; ToolTip=&#8221;!(loc.SetupTypeDlgCompleteButtonTooltip)&#8221; Text=&#8221;!(loc.SetupTypeDlgCompleteButton)&#8221;&gt;<br />
&lt;Publish Property=&#8221;WixUI_InstallMode&#8221; Value=&#8221;InstallComplete&#8221;&gt;1&lt;/Publish&gt;<br />
&lt;Publish Event=&#8221;SetInstallLevel&#8221; Value=&#8221;1000&#8243;&gt;1&lt;/Publish&gt;<br />
&lt;/Control&gt;</p></blockquote>
<p>If you wanted to explicitly list features, the easiest way to do so is to use an AddLocal control event with an argument of ALL to install all features locally, then use individual <a href="http://msdn2.microsoft.com/en-us/library/aa371210.aspx">Remove control events</a> to remove the features that don&#8217;t apply. Doing so covers lets the user both install and uninstall features. For example:</p>
<blockquote><p>&lt;Control Id=&#8221;Next&#8221; Type=&#8221;PushButton&#8221; X=&#8221;235&#8243; Y=&#8221;243&#8243; Width=&#8221;57&#8243; Height=&#8221;18&#8243; Default=&#8221;yes&#8221; Text=&#8221;&amp;Next &gt;&#8221;&gt;<br />
&lt;Publish Event=&#8221;AddLocal&#8221; Value=&#8221;ALL&#8221;&gt;1&lt;/Publish&gt;<br />
&lt;Publish Event=&#8221;Remove&#8221; Value=&#8221;FeatureX&#8221;&gt;NOT FEATUREX_CHECKBOX&lt;/Publish&gt;<br />
&lt;Publish Event=&#8221;Remove&#8221; Value=&#8221;FeatureY&#8221;&gt;NOT FEATUREY_CHECKBOX&lt;/Publish&gt;<br />
&lt;Publish Event=&#8221;Remove&#8221; Value=&#8221;FeatureZ&#8221;&gt;NOT FEATUREZ_CHECKBOX&lt;/Publish&gt;<br />
&lt;/Control&gt;</p></blockquote>
<p>Hope this helps understand why things aren&#8217;t always as simple as a first glance might indicate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

