How to create a MSI file which simply copies a dir

2019-01-20 20:40发布

问题:

I want to create a MSI file, which simply copies a directory into the "Program Files" directory and creates an icon in the start menu.

Nothing more. No questions to the user, no dependencies, no registry entries, etc. Just copy the directory and set the icon.

And if we deploy a new version of our program, then the MSI should just copy the new one over the old one. No "uninstalling" procedure.

Which tool to use for this task?

回答1:

Just to extend on Stein's answer, with the free edition("Simple" projects only) of Advanced Installer you can build this simple package.

After you create the project just go to Product Details page and disable the option that says "Register with Windows Installer".

Most likely all of the tools mentioned above have a similar option, you just need to search it as I am not that familiar with all their ins and outs (P.S. I work on the team building Advanced Installer).



回答2:

I guess the answer is any common tool, since they can all do this. Here is a list of (arguably) the most common tools.

  • The Visual Studio Installer Projects (2017) are pretty simple to use - at first - and then you face a number of limitations and shortcomings that you might not be susceptible to - given your scope. Can not be automated in a build process as far as I know!
  • Advanced Installer is a commercial product and it has some free features that you can use for requirements such as yours. You could give it a test spin. Here is a great gateway to all things Advanced Installer.
  • WiX is capable of what you want to do, and entirely free. Takes a while to get used to. The Hello World of WiX (a little old and dated, but you get the picture - XML markup that is compiled to MSI format). For some reason, this messy answer of mine on WiX Quick Start has been upvoted more than usual. Maybe skim it.

See linked answer on top for direct download links.


Silent Install: Any MSI file can be run silently (without a GUI) by means of a standard msiexec.exe command line:

msiexec.exe /I "C:\Your.msi" /QN /L*V "C:\msilog.log"

Quick Parameter Explanation:

/I = run install sequence
/QN = run completely silently
/L*V "C:\msilog.log" = verbose logging at specified path