0

I have a project in the company I'm working, where I have to automate the collection of PDBs for certain .NET applications for which we deliver an MSI to our customer.

My team leader wants me to store only the PDBs of the DLLs going into the MSI. The MSI is built using the software Installshield 11 Pro. An ism file is given as input to it.

Is there a way to programatically retrieve only the paths of the DLLs added in the ISM file? This will help me to retrieve the PDBs from the same paths as well. Correct me if I am wrong in this approach.

Edit 1:- Sorry I didn't make myself clear before. I'm new to software dev so please bear with me. As I said we use Installshield 11 Pro to build an ISM file that contains details of all the paths of the DLLs going into the MSI. This ISM file is used to build the MSI after all the .NET projects have been built.

Only some of the DLLs generated from the projects are used to build the MSI. So we wanted to store only the corresponding PDBs of those DLLs. As newer DLLs may later be added to the MSI using the ISM file I needed an automated process to retrieve the paths provided in that ISM file.

Correct me if this approach is wrong? Should I save only the corresponding PDBs of the DLLs going into the MSI or saving all the PDBs is recommended??

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • Don't quite understand what you mean. Extract all files and sort by extension and get a full list that way? Also: you should be able to use feature release flags to make a feature contain all *.pdb files and you can then create a debug release version of the setup that installs these files for your QA team? – Stein Åsmul Jul 31 '20 at 14:31
  • When Stein is talking about extracting files I think he means to do an administrative install msiexec /a , https://learn.microsoft.com/en-us/windows/win32/msi/administrative-installation. Then you could 'dir *.dll /S /B' that directory. – Doc Aug 02 '20 at 14:08
  • @SteinÅsmul Sorry I did not make my question clear. I wrote an edit and you can read it now. – Raja Shekar Aug 03 '20 at 12:34
  • @Doc Thank you for the clarification but I don't think I was necessarily looking for that. I made an edit to my question so please check that out – Raja Shekar Aug 03 '20 at 12:35
  • Yes, [I meant an administrative install - as explained here](https://stackoverflow.com/questions/5564619/what-is-the-purpose-of-administrative-installation-initiated-using-msiexec-a/5751980#5751980). – Stein Åsmul Aug 04 '20 at 02:13

1 Answers1

0

Are you looking to iterate through the MSI file and maybe store specific files at runtime?

If you are looking to store the files at run-time, please take a look on the below script code that opens the MSI at runtime and iterate through the MSI File table and select the files under a spefic component:

try
        {
            session.Log("Begin GetFilesPath custom action");

            // get folder path through its property
            string folderPath = session["aFolder_Dir"];

            List <string> filesPathList = new List<string> ();
            
            session.Log("Database open");
            using (var database = session.Database)
            {
                session.Log("Database openned");
                using (var view = database.OpenView(database.Tables["File"].SqlSelectString))
                {
                    session.Log("File table openned");
                    view.Execute();
                    
                    //Get the files from table that are part of ||||OtherFileCopy2.txt||| component
                    foreach (var rec in view) 
                    {
                        if (rec.GetString("Component_") == "OtherFileCopy2.txt")
                        {
                            filesPathList.Add(folderPath + rec.GetString("File"));
                        }
                    }
                    // List files in the log
                    session.Log("The files that are assigned under the *OtherFileCopy2* component are:");
                    foreach (var test in filesPathList)
                    {
                           session.Log(test.ToString());
                    }
                }
            }
            session.Log("End GetFilesPath custom action");
        }
        catch(Exception ex)
        {
            session.Log("Error on GetFilesPath: {0}", ex.ToString());
            return ActionResult.Failure;
        }
       
        return ActionResult.Success;
    }
J.Tribbiani
  • 454
  • 3
  • 9
  • Thank you for your approach but I don't think I was looking for this. I made an edit to the question I asked so please check that out. – Raja Shekar Aug 03 '20 at 12:40