"Compatible" shared packages? #7569
Replies: 6 comments 6 replies
-
Think of the shared packages like shared files. Do your versioned bundles need specific versions of the shared packages, or will the latest versions of those shared packages always work just fine? If the shared packages need to be versioned, they must be installed in a SxS (side-by-side) fashion, meaning that they must always be changing their installation paths (both filesystem and registry) for every version and they must not share UpgradeCodes (since they are no longer "upgrades" to each other), and you should continue using ProductCodes as dependency keys. If the latest version always just works, then you should continue building them the same way as today, but use the MSI UpgradeCode (or any other relevant but fixed identifier) as the dependency keys, for the behavior you are looking for. If your scenario is between these two, then you need to create your own dependency key schema. See this page for more detail (note that page explicitly states that using ProductCodes (the default) does not support upgrades (and by implication, downgrades) when used as the key, which is what you are seeing in your experience above). |
Beta Was this translation helpful? Give feedback.
-
{33333333-F197-48F8-B6AC-5102D36BBCE0} is the product code of v3 of the shared package. It is not used as a dependency key. We do not use any Requires tag. Should we? From my understanding, the dependencies are registered using the Provides tags, and premature uninstallation is (or should be) inhibited by refcounting the dependencies registered for each provider - very similar to shared components in MSI. Is there now some comprehensive documentation on dependency authoring? In WiX3 documentation, that page only contains the text "ToDo". |
Beta Was this translation helpful? Give feedback.
-
So I will try with Requires elements. As to the concept: |
Beta Was this translation helpful? Give feedback.
-
Ok, so it is a concept that does make sense. And from my understanding, this does not need any explicit Requires setting (in the default case that all versions of the shared package are compatible). The Requires element would then just allow the developer to add some further restrictions. And I do not want the 1st bundle uninstall to err, just to keep the shared package in place. I do not understand your last paragraph, though. "Dependency:Register" in the Plan phase means that the dependency will be registered, regardless of whether or not the package will be installed. In this case, the dependency registration can be read from the log of the Apply phase - and from Registry. My expectation in the use case I described was:
Expectation 2 is not fulfilled (and I still do not understand why), but it strangely gets fulfilled when I add one more provider key to the newer version of the shared package. |
Beta Was this translation helpful? Give feedback.
-
Fully agreed. BTW, uninstallaing a package that is still required is what I called "premature uninstallation" above. So how to achieve this goal?
and then registers the current bundle as dependency on that provider:
Second installation registers the second bundle as dependency on the same provider. The result can then be viewed in the Registry under HKCR\Installer\Dependencies. Uninstallation of either bundle will then notice that there is another dependency on the same provider (sort of "refcounting") and inhibit the removal of the shared package, so the goal is achieved. Registering a dependency can be done does not require that the shared package is being installed - there are cases with
which will allow for refcounting and inhibit the premature removal on uninstall. But there are also cases with So what does actually determine whether or not a dependency gets registered? At least in our case, we assume all versions of the shared package to be compatible with older bundles. And why should the behaviour be different if one MsiPackage element brings two dependency providers instead of one? Documentation on dependency handling is rather poor - I would have loved to write that page ... |
Beta Was this translation helpful? Give feedback.
-
@robmen @barnson I don't recall who wrote the dependency code, but this might be a good time to push for the long-never-written documentation of this feature of WiX. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
We are developing several bundles that share some common MSI packages. We are still using WiX 3.11, trying to learn about 4.0 before migrating.
The various bundles can be installed side-by-side (with the shared products going to a shared location), and I cannot predict the order or the versions in which the user installs different bundles.
All the packages get major upgrades from time to time.
It is possible that the user first installs:
Bundle A in version 3.0 with version 3.0 of SharedPackage (which has ProductCode {33333333-F197-48F8-B6AC-5102D36BBCE0})
then
Bundle B in version 2.0 with version 2.0 of SharedPackage (which has ProductCode {22222222-F197-48F8-B6AC-5102D36BBCE0})
where the SharedPackage product code has changed from version 2.0 to 3.0
The WiX code for both bundles contains:
In the above scenario, I expect Bundle B to not install the SharedPackage, but to register the current bundle as dependency on both providers listed above.
But I get a different behaviour. Bundle B install log file tells me:
i103: Detected related package: {33333333-F197-48F8-B6AC-5102D36BBCE0}, scope: PerMachine, version: 3.0.0.0, language: 0 operation: Downgrade
i000: Detected existing related package SharedPackage (product: {33333333-F197-48F8-B6AC-5102D36BBCE0}) at version 3.0.0.0, which will be Downgrade
[..]
i101: Detected package: SharedPackage, state: Obsolete, cached: None
and a bit later:
i201: Planned package: SharedPackage, state: Obsolete, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
and this dependency is really not registered! As a consequence, the SharedPackage gets removed on Bundle A uninstallation even though it is still needed by Bundle B.
So the generic dependency provider key seems not to do here what we introduced it for. This is a behaviour I do not understand.
What is even more strange:
If I add the SharedPackage v2.0 product code as dependency provider key to v3.0 bundles (here: Bundle A)
Bundle B install log file says:
i108: Detected compatible package: SharedPackage, provider: {22222222-F197-48F8-B6AC-5102D36BBCE0}, installed: {33333333-F197-48F8-B6AC-5102D36BBCE0}, version: 3.0.0.0, chained: {22222222-F197-48F8-B6AC-5102D36BBCE0}
i103: Detected related package: {33333333-F197-48F8-B6AC-5102D36BBCE0}, scope: PerMachine, version: 3.0.0.0, language: 0 operation: Downgrade
i000: Detected existing related package SharedPackage (product: {33333333-F197-48F8-B6AC-5102D36BBCE0}) at version 3.0.0.0, which will be Downgrade
[..]
i101: Detected package: SharedPackage, state: Obsolete, cached: None
[..]
i201: Planned package: SharedPackage, state: Obsolete, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Register
and everything works fine.
So from my understanding, a major-upgraded shared package is "compatible" with its current version if and only if its current product code is listed as dependency provider key in the current bundle.
So are we missing something?
Best regards
Matthias Reuss
Beta Was this translation helpful? Give feedback.
All reactions