Recommended .NET app installer? - windows

I need to create an install for my app that executes the following actions:
Copies files
Writes registry settings
Registers a windows service
Writes an XML app.config file (based on user supplied info during install--a connection string)
Executes SQL scripts against a remote database (connection info obtained in #4)
Installs and registers a COM dll
Adds entry to Control Panel>Add/Remove programs for uninstall
I don't need any fancy logic to allow the user to customize these steps--I can hard-code them with user-supplied info injected where appropriate.
I looked at Wix but found the documentation and examples don't line up well with recent releases.
I also looked at NSIS but found support for writing XML to be too limited (the plugin for this can only handle strings up to 64 bytes).
I initially brushed off the VS2005 built in Setup project as incapable of handling these tasks but I'm ready to reconsider after stumbling with what I thought were better options.
Any suggestions?

I would still recommend looking into WiX a bit more. We use it to do everything but #6 on that list and while there is a small learning curve. We've been using WiX v3 for almost 3 years, and I haven't found too many places where the docs/tutorial is that far out of place. And usually where it is its because they cleaned up the syntax and made it better.
Also, as of the next release of Visual Studio (2010/Rosario) WiX is being build directly into Visual Studio, I'm not sure if in parallel with the current Setup Projects or replacing them completely.

A Visual Studio Installer project can do whatever custom code you want; wouldn't see why any of your requirements would be a problem.

I have used Visual Studio (2005) and Wise and can recommend both. You didn't mention if the tool had to be free, and if so that rules out Wise. Nevertheless Wise has a dead easy learning curve and is very powerful and well documented. I have had a few weird things happen to me with Visual Studio. One time I had to delete my project and start over (possibly due to stupidity on my part - never figured it out), but overall I have been using it for a couple years at my current job and it works for me.

You can use just Visual Studio and Windows without commercial tools to achieve what you need.
First, check out the answer to create a single installer file.
Then, you can research how to create a Custom Action class that can perform registry, read/write files and register COM dll's separately.

Related

Generate an installer

Over the years our InstallShield code has grown un-manageable and messy. We're about to design an InstallShield 2015 installation from scratch for a new major release, and I was wondering if there's any way to automatically capture a set of system changes to use as a cleaner starting point for developing a new install package. Ideally, I would like to turn on some capturing software, install the oldest release from which we support an upgrade, install the latest service packs, and then apply the manual changes that will get the new release running on the system. Then I would turn off the capturing software, and it would provide an InstallShield project pre-loaded with all the files and registry entries (GAC changes, .NET assemblies, etc) that were created as part of that install. Then I could add steps to delete those that we no longer needed and do some other clean-up and refinements. Does such a thing exist?
Yes, this is called a repackager most often, in the enterprise world where sys admin and packagers prepare applications for deployment on the company machines.
Flexera has one that can create a project for InstallShield, but it is sold together with their AdminStudio solution, which is not cheap.
We (at Caphyon) have a repackager included in Advanced Installer (the architect edition) which also requires you purchase license. And of course the generated project will be compatible only with Advanced Installer, where you can configure your installers as you wish.
I think there is also a free repackager, AppDeploy from Dell, but I never used it, so I don't know how accurate it is and if you can use the results created into InstallShield or if it generates directly an MSI.
If you started looking more careful you will probably find other repackager tools, but you should know that building such a tool is not an easy task so choose carefully. Also probably only the one from AdminStudio will be able to generate a project that can be read by InstallShield.
If you already have the source projects from the older editions I would personally not try using a repackager. Instead I would go for cleaning up all the configurations which you do not understand and re-build them from scratch.
A repackager as good as it can be still has some problems. It can capture incomplete data, for example if you have a custom action that runs different code based on the OS where the installer is running the repackager will capture only its effects on the OS where you run it. On another one might run differently and have another output.
Also if your installer has prerequisites and you run the repackager on a machine where those prerequisites are installed then the repackager will not capture anything related to this, so by accident you can forget to include required prerequisites in the new package.
There is also the things like meta-information which few repackagers can detect. For example files associations which are actually a set of file and registry entries connected together or environment variables, scheduled tasks, etc...
Most repackagers capture all this data and simply show it to you as configuration files and registry entries, instead of creating the correct entities in your projects, i.e. files associations, environment variables or scheduled tasks in their correspondent views.

Are Visual Studio Setup projects suitable for complex setups?

Are "Visual Studio Setup" projects suitable for complex setups in different versions?
The application is rather large (> 500,000 lines of code) and is under continuous development. Every 6 to 10 months a new version gets released. We have multiple configuration files (INI and XML), registry keys, database migration scripts, etc. The application is in the progress of being migrated from Visual Basic 6.0 to .NET. The old installer was build with Installshield. The feedback to Installshield is: Bad adaptability, bad reuse - that's why we are evaluating "Visual Studio Setup" as an alternative.
Other products we consider:
Free Solutions
WiX
NSIS
Commercial Solutions
Installshield (again...)
Wise
Advanced Installer
Is Something missing?
Solutions we don't like to consider:
Inno Setup (it just doesn't feel right)
No, no, no and no to Visual Studio Deployment projects. I've been there on "large" projects (15,000 files with thousands of merge modules and hundreds of InstallUtil custom actions because VDPROJ exposes almost nothing of the underlying MSI such as creating services). I could go on for hours about how horrible it truly is.
I have a team of four installation developers and we use a mix of WiX and InstallShield. Our typical install has nearly 100 features, 800 merge modules and 15,000 files. We deploy nearly every type of resource you can imagine including chaining third-party installs to create complete products or systems. We are able to do this for over a dozen products each building off of multiple integration, release and maintenance branches. The four of us support an organization of over 400 people with around 250 developers.
We are able to do this because InstallShield actually can give you a fair amount of reuse. You use product configurations and features / merge modules to create encapsulations of groups of files and business logic. Still, WiX does a better job (although much harder to learn and feature holes here and there that we still need InstallShield for), so we have been slowly transitioning our baseline over to WiX where possible.
Don't go there!! We thought it was feasible for a few simple installers but it has turned out to be a nightmare... At a first glance the VS setup projects look ok, but soon you'll realize the various deficiencies - meaning that you'll write a bunch of custom action code for accomplishing just the simplest tasks (e.g., service handling and installation into well-defined special directories that are just not accessible from the "nice" setup project GUI).
You can only use some very basic forms to get user input (password input is for instance not possible). There is no automatic incrementing of installer version numbers. The file handling is horrible - you manually have to pick each and every file. That is, you cannot just say "install all files in this directory into that directory" - fantastic task to sit and manually scan for new files in a directory with hundreds of files.
No, go for WiX, although the learning curve might seem slightly worse than for the VS installers - but I have regretted it many times that we didn't do that.

Capturing all changes during an application install on Windows

I need to monitor and report on all changes (folders and directories added, permissions changed, registry entries added) that are made during the installation of a software program. Can anyone suggest a tool that is capable of doing this?
Thanks, MagicAndi.
Note: Please see my other answer below as well.
Seeing as you want to create a Wix setup, I want to add a new answer with some hints on how to accomplish this in the quickest way.
I would recommend using the InstallRite (no longer available) software to get a log of changes done by the installer you got. This tool does not allow you to convert the capture into an MSI, but it gives you a good change log (which does contain a bit of junk). The PictureTaker tool appears to have been renamed and is now commercial - it does allow conversion of the capture to MSI though.
There seems to be a new capture tool called Scalable Smart Packager CE (link removed Nov, 2017 - target site has changed and looks a little suspicious). I have not tested this tool thoroughly.
Once you have your log or capture, you can convert to WIX in 2 "fast track" ways:
Use the dark.exe WIX MSI decompiler (if you have an MSI already)
Use the heat.exe WIX harvester tool (to auto-generate WIX XML for folders, registry etc..)
If you use the dark.exe tool you should get a complete WIX XML file that you can then compile again - but you should clean it up a bit (take out the UI junk, then link with WIX's detault built-in GUI etc...).
Using heat.exe is the cleaner way. You simply run the heat.exe tool against a folder, and it will create WIX XML elements for you to install those files. You will then need to put it all together in a WIX source files along with other required sections. I can provide you with a basic WIX "minimal sample" to get you going (I don't seem to be able to attach files here).
Looks like this is a duplicate of a question answered already on ServerFault (my bad!). The answers given there are:
Process Monitor from SysInternals Software
Total Uninstall from Martau.com
UPDATE: Stefan Kruger's comprehensive list of repackaging tools at installsite.org.
Your question is a bit open ended since it is not entirely clear what the overall goal is:
Application Repackaging: capture all changes and then package them into a deployable package format such as MSI (or similar).
Reporting / Monitoring: just looking for a way to "see what happens" during an installation.
For application repackaging the main tool is AdminStudio (the main competitor "Wise InstallStudio" was pulled from market due to legal issues, see Wise section here: What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc).
AdminStudio has very comprehensive feature sets and a hefty price tag (and learning curve). You could try to use the trial version to do your repackaging and see if the resulting MSI is useable. If it is not you can convert it to a Wix MSI relatively easily via the dark.exe Wix tool.
Then there used to be more light weight tools such as PictureTaker and InstallRite which I suppose were better suited for "reporting purposes" but could be used for MSI creation. Both these tools seem to have disappeared as well.
There seems to be a new capture tool called Scalable Smart Packager CE (removed broken link Jan, 2018 - the tool appears discontinued). I have not tested this tool thoroughly.
UPDATE: I just removed a broken link to Scalable Smart Packager CE (appears discontinued). For repackaging software / tools, perhaps see Stefan Kruger's comprehensive list at installsite.org. Hard to keep up with all these tools that are useful but end up deprecated.
You could use the method suggested here: Tracking file and registry changes, or you can try to locate the old version of WININSTALL LE on a Windows 2000 Server CD in \VALUEADD\3RDPARTY\MGMT\WINSTLE.
I believe Advanced Installer allows capture, but I am not sure you can export a proper MSI file with the trial version (or at all for that matter).
I've used Process Monitor on multiple occasions to document the impacts of installing COTS software on servers. Has always seemed to do the trick.
There is a programme called "sandboxie"
You'll need to configure it once its installed for it to work properly.
run sandboxie. drag and drop the installation file into the gui and watch it try to install.
Sandboxie creates a log of everything that happens. While it redirects all of the exe - DLL - inf - scripts and everything else into a quarantine file instead.
The SB GUI then lays out the file structure to all the intended installation locations.
Any download Im not too sure is legitimate, now gets downloaded and executed straight through SB's web browser feature. I can then check it all out and it never infects my system if it is naughty.
On the other hand...
If it was a online installer.exe that was executed in SB gui, youll now have a copy of everything that makes up the installer package. Place it all in a file on a USB, make a simple autorun.inf and .bat file with notepad++ to create ya own offline installer
Hope this helps...

Are there any limitations with Visual Studio Setup Projects?

Are there any limitations that I might face when using VS Setup Projects?
I plan to use them, but am not sure if this would be a good idea.
Well, in a more advanced setting: VS Setup Projects cannot be automated, e.g. you cannot put your project and the VS Setup Project on a build server and have them built automatically. This might not be an issue for a smaller shop or a single developer, but for a larger enterprise-level development environment, this alone can be quite a killer criteria.
In order to get around this, we use WiX for our setups - more work once up front, but works nicely with continuous integration.
Marc
They are OK, if your starting from scratch I would say look into WIX, or even pony up the cash for Install Shield or one of the other commercial ones, would save you time and money in the long run.
Builds can be very slow, especially if you have a lot of binary files. I have a project with a lot of product images that get packed into the install package, this takes a LONG time, even on a fast machine.
Visual Studio Setup projects lacks a number of key features that Windows Installer Provides. Most notable of these is the 'Feature' feature that allows you to setup several tools that the user can choose to install or exclude. As already recommended, use WiX or a 3rd party full-featured installer tool.
It depends on your project I suppose. It used to be a pain to use to set up web projects, but I think there is an addin now that makes creating a web app setup a lot easier.
More limitations...
There is no way in setup project to perform validation on data that has
been provided by the user on the UI dialogs (acquisition phase).
There is no way to designate a custom action to run with elevated
privileges(System account).
There is no way to make your custom action execute during UI sequence.

Visual Studio 2005 Setup project application folder default location on potentially non-existent volume

I have a Visual Studio 2005 solution that includes a setup project. The setup project specifies "d:\somefolder" as the Application Folder DefaultLocation property. When installing on a machine without any partitions mapped to "d:", the resulting installer craps out with the message
"The volume d:\ is currently unavailable. Please select another."
Trouble is, you don't actually get a chance to select a different install location (on an existing volume). What settings should I use to enable the user of the installer to change the install path, while keeping the default as d:\some_folder?
the Setup and Deployment projects from VS leave quite a bit to be desired. Every solution I am aware of will take a bit of reading and learning, as the GUI tools that make setup's for you are normally rather limiting in customization outside the realm of changing the actual look of it. I would recommend looking into the WiX (Windows Installer XML) toolset for making installations. The learning curve is one of the most user friendly ones that I have seen on the market, plus it is a free tool. As long as you have a fairly decent understanding of XML you have everything that you need in order to start making MSI's.
I suppose there should be setups available which let you change the destination.
Or you could use orca to add in a dialog box which specifies that.
Or you could pass it in as a commandline argument if the user is on a commandline interface.

Resources