- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to share files between Features in InstallShield MSI InstallScript project?
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
How to share files between Features in InstallShield MSI InstallScript project?
Forlks,
How to share files between Features in InstallShield MSI InstallScript project?
I have some common files that I want in Feature A and B.
I added them to both features. But when I uninstall these common files are not getting removed.
What is the recommended way to share files between features.
thanks in advance.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Are the common files installing to the same directory? If so this would break Component Rules - https://learn.microsoft.com/en-us/windows/win32/msi/what-happens-if-the-component-rules-are-broken
"If two components have a resource under the same name and location and both components are installed into the same folder, then the removal of either component removes the common resource, which damages the remaining component."
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi,
Yes, the common files are installed at the same directory. Thanks for the link.
So any idea how to go about this? Appreciate any recommendations.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi,
I was able to take below approach and seems to work. Would you please advise if this is acceptable?
Instead of including the common files (that have same name and location) in Feature A and B, I created a Feature C which includes these files. Feature C is not visible to the user but is a required Feature for Feature A and B. This seems to work, common files are getting installed and removed appropriately.
Appreciate your input.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Perfect solution - and one that I would have suggested.
If further down the line things become more complex and more features are introduced which are optional and don't require the shared files - you can look into creating conditions for the Feature C to only install if specific other features are selected.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
To share files between Features in an InstallShield MSI InstallScript project, you can use the "Shared" component feature.
First, create a new component in the Components view of the InstallShield project. Then, set the component's Shared property to "Yes". This will allow the component to be shared between different features.
Next, add the shared component to each feature that requires access to it. To do this, go to the Feature view of the InstallShield project, select the feature, and add the shared component to its Components list.
Once the shared component is added to multiple features, any file included in that component will be available to all features that include the shared component.
For example, suppose you have an InstallShield project that includes two features: "Chalets" and "Lebanon". If you want to share a file between these features, you can create a shared component and add it to both features. Any file included in the shared component will be accessible to both features, so you could include a file named "ChaletsForRent.txt" that contains information about chalets for rent in Beirut, Lebanon.
So, to sum up, by creating a shared component and adding it to multiple features in your InstallShield project, you can share files between those features. For example, you can share a file containing information about chalets for rent in Beirut Lebanon between the "Chalets" and "Lebanon" features.
