Custom installer for application in Visual Studio

2019-01-28 14:56发布

问题:

I need to generate an installer for my application but first I need to know if it is already installed on the system node.js, npm and other applications

Is it possible to include the installation of node.js within the installation of my application and to know if it is already installed?

I'm using Visual Studio 2017 and a WPF project for desktop applications

When the application is already installed I need to execute npm commands in the console for this reason I need to install them before or verify if they are installed correctly

I appreciate any help.

回答1:

UPDATE: Advanced Installer: How to install a NodeJS web app. Really excellent videos IMHO.


Best Effort: I don't know much about Node.Js, and hence should not answer. But I haven't seen anyone else answering these questions either. Despite lacking experience, let me try to give a few suggestions.

Windows Installer: There seems to be an MSI you can use to deploy Node.Js. And there are some alternatives listed. (Essentially Chocolatey and Scoop).

Heads-Up: I have answered a more specific deployment question relating to a failed installation of the Node.Js MSI earlier: Node.js installation (windows installer) terminates prematurely on windows 10 64-bit. This may or may not be fixed.

Deployment: To deploy a prerequisite MSI before your own package installation, you can use a deployment tool capable of bootstrapping / sequencing / downloading - in other words to run several installation operations in a given sequence wrapped as a setup.exe. Or you could investigate the Chocolatey approach. With regards to the deployment tools, I am a bit tired of writing up the list of capacities these tools have and don't have. I will link to a few flavors of answers for this:

Prime Suspects:

  • Installshield Suite Projects - screenshot of Suite projects.
  • WiX Burn Bundle - beware: link overload. But there is a "Hello Burn" example. Official WiX documentation.
  • Advanced Installer - Prerequisites View - screenshot of view available in some project types.

One of the above tools should be able to do the job. Only WiX Burn is free and open source. Sometimes you can save a lot of time by going with a commercial tool. Obviously especially if your company already have a license for such a tool (which can be a days work to figure out).

Free Tools: In the realm of free-tools only and alternatives to WiX, some people use self-extracting archives made with 7-Zip and WinRAR and some other tools described here: Combine exe and msi file in one installer. I don't like this for security reasons and other reasons as explained in the link.

Simplicity: For corporate deployment a simple batch file or some custom construct distributed via your deployment system (SCCM, etc...) could suffice. Or even a zip with an embedded batch file to kick off your zipped installers in sequence could work. All depends on your scenario. I wouldn't roll with such an approach for global distribution.

And here are several other answers where I describe available deployment tools:

  • How to create a MSI file which simply copies a directory to Program Files?
  • Visual Studio 2017 Installer Project - include VC++ 2015 Redistributable

Some Links:

  • Create MSI from extracted setup files
  • Error Creating a 7-zip installer package
  • How to create windows installer
  • What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc
  • Nodejs - Another installation is in progress