michaeldhenry
Occasional contributor

ISWiComponentSubFolder method creating some but not all folders

Jump to solution

For various reasons I am trying to dynamically populate an InstallShield InstallScript project with files using the Automation Interface (COM interface) within InstallShield 2020 R3.  I am making the calls with PowerShell and iterating through the file structure I want in the installer.  I have it working but have run into an issue.  I am using the AddComponentSubFolder method on ISWiComponentSubFolder objects as I recursively iterate through the folder structure.  I am using debug statements within my PowerShell script to verify what is happening and see a statement that says, “Adding folder reports to folder SFRxOP” and then verify that it actually found the “SFRxOP” component/folder correctly.  It throws no errors.  I then save and close the project in PowerShell, open up the project in InstallShield and all of the folders (and subfolders) previous to the reports folder are there, but the reports folder (and the ui folder which would follow the reports folder) is not there under “Files and Folders”.  I then decided to build the project and run the installer it generates and, sure enough, it lays down the previous folders, but no report or ui folders.

I've attached to images.  The first shows the source folder structure and the second shows what is in InstallShield after I execute the calls to the COM interface via PowerShell.  The first image has all five folders (Analytics, class, jobs, reports, and ui), but the second image shows that only Analytics, class, and jobs showed up in the InstallShield project.

Has anyone else run into a situation like this?

Labels (1)
0 Kudos
1 Solution

I just wanted to report back that I found the issue and it was NOT an issue with the ISWiComponentSubFolder method, it was a problem in my PowerShell script.  I was using a hashtable to track the different subfolder component objects as I recursively move through the folders.  I was only using the folder name as my hashtable key and at times there were folders within the path with the same name.  For example, models\SFRxOP\reports\c\Analytics\c\AnalyticTables.  Because I was only using the folder name, when I would pass from models\SFRxOP\reports\c to models\SFRxOP\reports\c\Analytics\c it would clobber and overwrite the previous hashtable entry for the previous "c" folder.  BIG oversight on my part.  I switched to using the entire path as the key and it solved the problem.  Thank you for your time.

View solution in original post

0 Kudos
5 Replies
Revenera_Ian
Revenera
Revenera

Hi @michaeldhenry,

Thank you for your post.

I'm not familiar with this specific issue, but we'd be happy to help. We need some more information, though.

Could you please provide your project type? Basic MSI? InstallScript? InstallScript MSI? The project type is displayed on the top title bar of InstallShield in square brackets: [<Project Type> Project].

Could you please provide a simple sample project of the same project type as your full project that reproduces the issue, along with a simple sample PowerShell script, the simplest sample project that reproduces the issue? I'm referring to a sample project that does not contain any sensitive, proprietary, confidential data but reproduces the issue.

Please let me know if you have any questions or concerns. Thank you for your patience and cooperation.

 

0 Kudos
This is an InstallScript project and I'll see if I can pull together a sample project that reproduces the issue.
0 Kudos

Thank you for your reply and willingness to put together a sample project.

Sounds good. Let us know how it goes.

Please let me know if you have any questions or concerns. Thank you for your patience and cooperation.

0 Kudos

I just wanted to report back that I found the issue and it was NOT an issue with the ISWiComponentSubFolder method, it was a problem in my PowerShell script.  I was using a hashtable to track the different subfolder component objects as I recursively move through the folders.  I was only using the folder name as my hashtable key and at times there were folders within the path with the same name.  For example, models\SFRxOP\reports\c\Analytics\c\AnalyticTables.  Because I was only using the folder name, when I would pass from models\SFRxOP\reports\c to models\SFRxOP\reports\c\Analytics\c it would clobber and overwrite the previous hashtable entry for the previous "c" folder.  BIG oversight on my part.  I switched to using the entire path as the key and it solved the problem.  Thank you for your time.

View solution in original post

0 Kudos

Thank you for your reply.

You are welcome; happy to hear that this issue was resolved.

Please let us know if you have any questions or concerns. Thank you for your patience and cooperation.

0 Kudos