1

I am following these steps to extract a file from MSI and edit it and keeping it back. But when I install the new MSI, its not able to find the files inside the cabinet (.cab).

  1. Extract the cab file from MSI

    msidb -d "Setup.msi" -x Client.cab

  2. Extract the file from cab file.

    cabarc X Client.cab *.* C:\ClientExtract\

  3. Edit the extracted file inside folder C:\ClientExtract

  4. Create a new cab file from modified files

    cabarc N Client.cab C:\ClientExtract\*.*

  5. Remove the existing cab from Setup.msi

    msidb -d "Setup.msi" -k Client.cab

  6. Add the newly created cab file to msi

    msidb -d "Setup.msi" -a Client.cab

Now, this MSI file is not getting installed and its saying some file is not found. When I am running steps1, 5 and 6 only, the MSI works smoothly. I believe the issue will be with cabarc.exe which is not able to maintain the folder structure.

Any help or alternative solution will be appreciated. msi2xml and xml2msi works but I cant use that.

PawanS
  • 7,033
  • 14
  • 43
  • 71

1 Answers1

0

Since you tagged this question C#, I suggest writing a class library using the DTF interop libraries as helpers. It's a robust programming platform compared to batch files. You'll use the Microsoft.Deployment.WindowsInstaller and Microsoft.Deployment.Compression.Cab assemblies.

The way I prefer to do it is to leave the existing cab alone. I create a new cab and stream it in. I then update the File and Media table to register the cab and supersede the original file.

I have starter code I could share if you want to shoot me an email.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • yes, I agree with you, and I too started coding in C#. My first approach was using WinSDk tools else C#. Please share your code, it may help in my code too. – PawanS May 17 '13 at 11:25
  • It's an entire solution of projects. Not something I can just paste into an answer. Shoot me an email (I'm easy to find) and download the needed SDK from wix.codeplex.com. – Christopher Painter May 17 '13 at 12:51