Hi List,

Here is a contrived example of something that approximates what I'm trying to 
do in the real world:

I have 2 bundles, both of which use a shared component. I only want one copy of 
the shared component on the machine. Newer versions of the shared component are 
guaranteed to be backwards compatible with older versions.

I have 2 products, each of which require the shared component. I want a user to 
be able to install one, the other, or both products, and only have one copy of 
the shared component on their computer. I also want them to be able to 
uninstall the products, without it breaking the other, but have their computer 
clean when both are uninstalled.

This is where package reference counting is supposed to come in. The idea being 
my shared component gets reference counted, and only uninstalled when no 
references to it remain on the computer. This works perfectly, provided all the 
versions are the same, but starts going wrong when version upgrades are 
involved.

As an aside: I cannot find any good documentation on how package reference 
counting is supposed to work. My googling has lead me to believe that it is 
tied in with WixDependencyExtension, although it's not clear. Also, there's not 
really any good documentation on WixDependencyExtension either -- the 
documentation page on it at 
http://wix.sourceforge.net/manual-wix3/author_product_dependencies.htm is 
helpfully blank. If anyone can point me towards some docs on how it's supposed 
to work, that would be much appreciated. I've bought the Wix 3.6 book which 
probably has the best explanation I can find, but it doesn't cover this 
particular case.

So here's what I'm seeing:

Let's say I have 2 products. "A" and "B". Each use my shared component. When 
"A" was released, it used shared component version 1.1. When "B" was released, 
it used shared component version 1.2. 1.2 is a major upgrade to 1.1, however it 
is backwards-compatible.

Let's say I install "A", then "B". First version 1.1 is installed, then 1.2 is 
installed. Both work, everything is fine.

If I then uninstall "A" then "B", everything works as it should. "A" does not 
remove the shared package, but "B" does. 

However, if I uninstall "B" first and then "A", I have a problem: "B" refuses 
to uninstall the shared package, as it should. ("Will not uninstall package: 
sharedpackage, found dependents: 1") - However, when "A" is uninstalled, the 
package is left on the machine - presumably because it is not the package that 
"A" installed in the first place - it has been upgraded. It unregisters its 
dependency, but leaves the package there.

As such, after the 2 packages are uninstalled, my shared package remains on the 
machine. Worse, there is no listing for it in 'Programs and Features' because 
both bundles have been successfully uninstalled. I have to go digging around in 
c:\windows\installer to find and uninstall it.

I've looked in the documentation as much as I can, but can't find a way of 
telling Wix about this scenario, but lack of docs is hampering me somewhat. I'm 
not sure if there are some parameters I can add somewhere to say "it's OK for 
you to remove related packages instead of the one you installed", or something 
similar... Or, if this is a bug. Or, if this is by design. (I hope not!)

In my contrived example, I have two shared MSIs which are fairly standard 
installs. One notable thing is that I've added a Provides element as such:
<Component Id='providescomponent' Guid='MY-GUID-HERE'>
  <dep:Provides Id='aaardvark.sharedbundle' Key='aaardvark.sharedbundle'/>
</Component>

My bundle installers then reference this in their chain, with no particularly 
notable parameters. (I tried adding an additional "Provides" element as a child 
of the MsiPackage element, but it correctly complains that the MSI already 
contains this information)

Here is a zip file containing the wix source files for the example:
http://simon.wdgt.co.uk/bundle_refcount.zip

Here are what my bundle uninstall logs say about uninstalling in the latter 
case: (note: Contrived example, the bundles don't have their own extra 
packages, just the shared one)

Product B uninstall:
[1E0C:2AD8][2013-01-28T10:51:56]i001: Burn v3.7.1224.0, Windows v6.1 (Build 
7601: Service Pack 1), path: C:\ProgramData\Package 
Cache\{470f1494-5284-4a23-b775-77f0e222d46f}\product_b_bundle.exe, cmdline: 
'/uninstall -burn.unelevated BurnPipe.{157956B9-426E-4651-B1D0-22A5326591F3} 
{FFC4CE71-4C14-4DDD-B5C9-92CC27E15695} 9500'
[1E0C:2AD8][2013-01-28T10:51:56]i000: Setting string variable 'WixBundleLog' to 
value 'C:\Users\Simon\AppData\Local\Temp\My_Product_B_20130128105156.log'
[1E0C:2AD8][2013-01-28T10:51:56]i100: Detect begin, 1 packages
[1E0C:2AD8][2013-01-28T10:51:56]i101: Detected package: sharedpackage, state: 
Present, cached: Complete
[1E0C:2AD8][2013-01-28T10:51:56]i199: Detect complete, result: 0x0
[1E0C:2AD8][2013-01-28T10:51:57]i200: Plan begin, 1 packages, action: Uninstall
[1E0C:2AD8][2013-01-28T10:51:57]w327: Will not uninstall package: 
sharedpackage, found dependents: 1
[1E0C:2AD8][2013-01-28T10:51:57]w328: Found dependent: 
{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}, name: My Product A
[1E0C:2AD8][2013-01-28T10:51:57]i201: Planned package: sharedpackage, state: 
Present, default requested: Absent, ba requested: Absent, execute: None, 
rollback: None, cache: No, uncache: No, dependency: Unregister
[1E0C:2AD8][2013-01-28T10:51:57]i299: Plan complete, result: 0x0
[1E0C:2AD8][2013-01-28T10:51:57]i300: Apply begin
[251C:2144][2013-01-28T10:51:57]i360: Creating a system restore point.
[251C:2144][2013-01-28T10:52:04]i361: Created a system restore point.
[251C:2144][2013-01-28T10:52:04]i326: Removed dependency: 
{470f1494-5284-4a23-b775-77f0e222d46f} on package provider: 
aaardvark.sharedbundle, package sharedpackage
[251C:2144][2013-01-28T10:52:04]i330: Removed bundle dependency provider: 
{470f1494-5284-4a23-b775-77f0e222d46f}
[251C:2144][2013-01-28T10:52:04]i352: Removing cached bundle: 
{470f1494-5284-4a23-b775-77f0e222d46f}, from path: C:\ProgramData\Package 
Cache\{470f1494-5284-4a23-b775-77f0e222d46f}\
[1E0C:2AD8][2013-01-28T10:52:04]i399: Apply complete, result: 0x0, restart: 
None, ba requested restart:  No
[1E0C:2AD8][2013-01-28T10:52:11]i500: Shutting down, exit code: 0x0
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleAction = 3
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleElevated = 1
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleInstalled = 1
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleLog = 
C:\Users\Simon\AppData\Local\Temp\My_Product_B_20130128105156.log
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleManufacturer = 
Aaardvark Inc.
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleName = My Product B
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleOriginalSource = 
E:\Junk\bundletest\product_b_bundle.exe
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleProviderKey = 
{470f1494-5284-4a23-b775-77f0e222d46f}
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleTag = 
[1E0C:2AD8][2013-01-28T10:52:11]i410: Variable: WixBundleVersion = 1.0.0.0
[1E0C:2AD8][2013-01-28T10:52:12]i007: Exit code: 0x0, restarting: No

Product A uninstall:
[1F28:2934][2013-01-28T10:52:33]i001: Burn v3.7.1224.0, Windows v6.1 (Build 
7601: Service Pack 1), path: C:\ProgramData\Package 
Cache\{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}\product_a_bundle.exe, cmdline: 
'/uninstall -burn.unelevated BurnPipe.{C00E26AB-BBAD-4479-930E-00E97DD33106} 
{033295C7-E728-4D3E-A0A5-41CCD9FA461A} 10916'
[1F28:2934][2013-01-28T10:52:33]i000: Setting string variable 'WixBundleLog' to 
value 'C:\Users\Simon\AppData\Local\Temp\My_Product_A_20130128105233.log'
[1F28:2934][2013-01-28T10:52:33]i100: Detect begin, 1 packages
[1F28:2934][2013-01-28T10:52:33]i103: Detected related package: 
{BB9F6463-7D6E-42BC-BD87-0FF76E7AFD26}, scope: PerMachine, version: 1.2.0.0, 
language: 0 operation: Downgrade
[1F28:2934][2013-01-28T10:52:33]i101: Detected package: sharedpackage, state: 
Obsolete, cached: Complete
[1F28:2934][2013-01-28T10:52:33]i199: Detect complete, result: 0x0
[1F28:2934][2013-01-28T10:52:35]i200: Plan begin, 1 packages, action: Uninstall
[1F28:2934][2013-01-28T10:52:35]i201: Planned package: sharedpackage, state: 
Obsolete, default requested: None, ba requested: None, execute: None, rollback: 
None, cache: No, uncache: Yes, dependency: Unregister
[1F28:2934][2013-01-28T10:52:35]i299: Plan complete, result: 0x0
[1F28:2934][2013-01-28T10:52:35]i300: Apply begin
[2AA4:2B18][2013-01-28T10:52:35]i360: Creating a system restore point.
[2AA4:2B18][2013-01-28T10:52:42]i361: Created a system restore point.
[2AA4:2B18][2013-01-28T10:52:42]i326: Removed dependency: 
{a8b8ee64-db88-4c1a-bc57-3c7517aecf24} on package provider: 
aaardvark.sharedbundle, package sharedpackage
[2AA4:2B18][2013-01-28T10:52:42]i351: Removing cached package: sharedpackage, 
from path: C:\ProgramData\Package 
Cache\{B65434DE-6984-49FD-8E1B-7EED68D0A3C5}v1.1.0\
[2AA4:2B18][2013-01-28T10:52:42]i330: Removed bundle dependency provider: 
{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}
[2AA4:2B18][2013-01-28T10:52:42]i352: Removing cached bundle: 
{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}, from path: C:\ProgramData\Package 
Cache\{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}\
[1F28:2934][2013-01-28T10:52:42]i399: Apply complete, result: 0x0, restart: 
None, ba requested restart:  No
[1F28:2934][2013-01-28T10:52:44]i500: Shutting down, exit code: 0x0
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleAction = 3
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleElevated = 1
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleInstalled = 1
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleLog = 
C:\Users\Simon\AppData\Local\Temp\My_Product_A_20130128105233.log
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleManufacturer = 
Aaardvark Inc.
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleName = My Product A
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleOriginalSource = 
E:\Junk\bundletest\product_a_bundle.exe
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleProviderKey = 
{a8b8ee64-db88-4c1a-bc57-3c7517aecf24}
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleTag = 
[1F28:2934][2013-01-28T10:52:44]i410: Variable: WixBundleVersion = 1.0.0.0
[1F28:2934][2013-01-28T10:52:44]i007: Exit code: 0x0, restarting: No

Any ideas?

Thanks,
Simon

-- 
Simon Detheridge - CTO, Widgit Software
26 Queen Street, Cubbington, CV32 7NA - Tel: +44 (0)1926 333680

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to