0

I have used InstallAware and InstallShield before, and they are pretty difficult to work with and when something goes wrong it is very difficult to find and resolved the issue.

My question is why can't we use a Windows application written using C# to do this. I understand that .Net framework may not be installed on the destination computer, so I wonder why no one has ever used this architecture: I will create a simple installer using IntallSiheld(or any other similar tool) to just install .Net Framework and after that extracts and runs my own Windows application which I have written using C# in elevated mode. My application will run a Wizard with Back and Next button and I will take care of everything in it (copying files, creating and starting Windows Services, adding registry values, creating firewall extensions etc.) Has anyone ever done this, and is there anything that prevents people from doing this?

Mehran Balaei
  • 13
  • 1
  • 3
  • You sure can but but an installer does a bit more then showing a wizard. It can keep track of which components it installed and where, it can repair itself, it can rollback its actions, when a patch is delivered it knows what to replace. You can find all that in [Windows installer](https://msdn.microsoft.com/en-us/library/windows/desktop/cc185688(v=vs.85).aspx) and you're free to write your own wrapper around those functions. But if you're app is a simple xcopy deployment you can write that yourself. – rene Apr 18 '18 at 19:19
  • It is a chicken-and-egg problem. A winforms installer needs an installer to ensure the correct .NET framework version is available. – Hans Passant Apr 18 '18 at 22:43

1 Answers1

4

In essence: don't try to re-invent the wheel. Use an existing deployment tool and stay with your day job :-). There are many such tools available. See links below.

And below, prolonged, repetitive musing:


Redux: IMHO and with all due respect, if I may say so, making your own installer software is reinventing the wheel for absolutely no gain whatsoever I am afraid. I believe you will "re-discover" the complexities found by others who have walked the path that is involved in deployment as you create your own installer software and find that software can be quick to make, but very hard to perfect. In the process you will expend lots of effort trying to wrap things up - and "the last meter is very long" as you curse yourself dealing with trifles that take up your time at the expense of what would otherwise pay the bills. Sorting out the bugs in any toolkit for whatever technical feature, can take years or even decades. And no, I am not making it up. It is what all deployment software vendors deal with.

Many Existing Tools: there are many existing tools that implement such deployment functionality already - which are not based on Windows Installer (Inno Setup, NSIS, DeployMaster and heaps of other less known efforts):

My 2 cents - if you do not like MSI, choose one of the free, non-MSI deployment tools. How to create windows installer.

Corporate Deployment: The really important point (for me) is that corporate deployment relies on standardized packaging formats - such as MSI - to allow reliable, remote management of your software's deployment. Making your own installer will not impress any system administrators or corporate deployment specialists (at least until you sort out years of bugs and deficiencies). They want standardized format that they know how to handle (that does not imply that they are that impressed with existing deployment technology). Doing your deployment with standardized deployment formats can get you corporate approval for your software. If you make a weird deployment format that does unusual things on install that can't be easily captured and deployed on a large scale your software is head-first out of any large corporation. No mercy - for real. These are busy environments and you will face little understanding for your unusual solution.

"File-Pushers": Those of us who push files around for a living know that the field of deployment is riddled with silly problems that quickly kill your productiveness in other endeavors - the ones that make you stand out in your field - your day job. Deployment is a high profile, low status endeavor - and we are not complaining. It is just what it is: a necessity that is harder to deal with than you might think. Just spend your time more wisely is what I would conclude.

Complexity: Maybe skim the section "The Complexity of Deployment" here: Windows Installer and the creation of WiX. It is astonishing to deal with all the silly bugs that happen in deployment. It is not just a file copy, though it might be easy to think it is. And if it happens to be just a file copy, then there are existing tools that do the job. Free ones too. See links above. And if you think deployment is only file-copy in general, then please skim this list of tasks a deployment task should be capable of supporting: What is the benefit and real purpose of program installation?

Will your home-grown package handle the following? (just some random thoughts)

  • A malware-infected terminal server PC in Korea with Unicode characters in the path?
  • Symbolic links and NTFS junction points paths?
  • A laptop which shuts itself off in the middle of your file copy because it is out of battery?
  • Out of disk space situations? What about disk errors? And copy timeouts?
  • What about reboot requirements? For in-use files or some other reason. How are they to be handled? What if the system is in a reboot pending state and you need to detect it before kicking off your install?
  • How will you reliably install, configure and start and stop services?
  • How will you support uninstall and cleanup for your application?
  • Security software which flags your unknown, unrecognized, non-standard package a security threat and quarantines it? How would you begin to deal with this? Who do you contact to get into the good graces of a "recognized binary" for elevation?
  • Non-standard NTFS permissioning (ACLs) and NT Privileges? How do you detect it and degrade gracefully when you get permission denied? (for whatever reason).
  • Deployment of necessary runtimes for your application to work? (has been done by many others before). Download of the lastest runtimes if your embedded ones are out of date? Etc...
  • Provide a standardized way to extract files from your installation binary?
  • Provide help and support for your setup binaries for users who try to use them?
  • Etc... This was just a random list of whatever came to mind quickly. There are obviously many issues.

This was a bit over the top for what you asked, but don't be fooled to think deployment is something you can sort out a solution for in a few hours. And definitely don't take the job promising to do so - if that is what you are being asked. Just my two cents.

The above issues, and many others, are what people discover they have to handle when creating deployment software - for all but the most trivial deployments. Don't waste your time - use some established tool.

Transaction: If you are working in a corporation and just need your files to your testers, you can deploy using batch files for that matter - if you would like to. But you have to support it, and I guarantee you it will take a lot of your time. What do you do when the batch file failed half-way through due to a network error, and your testers are testing files that are inconsistent? Future deployment technologies may be better for such light-weight tasks. Perhaps the biggest feature of a deployment tool is to report whether the deployment completed successfully or not, and to log the errors and to roll the machine back to a stable state if something failed. Windows Installer does a lot of this work for you.

Distribution: A lot of people feel they can "just replicate my build folder to the user's computers". The complexities involved here are many. There is network involved, and network can never be assumed to be reliable, you need lots of error handling here. Then there is the issue of transactions: when do you know when the computer is in a stable state and should stop replicating. How often do you replicate, only on demand? How do you deal with the few computers that failed to replicate. How do you tell the users? These are distribution issues. Corporations have huge tools such as SCCM to deal with all these error conditions. Trying to re-implement all these checks, logging and features will take a long time. In the end you will have re-created an existing distribution system. Full circle. And how do you do inventory of your computers when there is no product registered as installed since only a batch file or script ran? And if you start replicating a lot of packages, how many times do you scan each file to determine if they are up to date? How much network traffic do you want to create? Where does it end? The answer: I guess transactions must be implemented with full logging and error tracking and rollback. Then you are full circle to a distribution system like I mentioned above and a supported package format as well.

This "just replicate my build folder to my users" ideas somehow remind me of this list: https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing. Not a 100% match, but the issues are reminiscent. When networking is involved, things start to become very unpredictable and you need logging, error control, transactions, rollback, network communication, etc... We have re-discovered large scale deployment - the beast that it is.

Network: and let's say you want to replicate your build folder to 10000 desktop machines in your enterprise. How do you kick off the replication? Do you start all replications at once and take down the trading floor of the bank as file replication takes over the whole network like a DDOS attack? Sorry - it is getting out of hand - please pardon the flippancy - but it really is upsetting that this replication approach is seen as viable for large scale deployment. Built-in Windows features could help, but still need to be tested properly. You need scheduling, queuing, caching, regional distribution shares, logging, reporting / inventory, and God knows what else that a packaging / deployment system gives you already. And re-implementing it will be a pain train of brand new bugs to deal with.

Maybe we one day will see automatic output folder replication based on automatic package generation which really works via an intelligent and transacted distribution system. Many corporate teams are trying, and by using existing tools they get closer with standard package formats used. I guess current cloud deployment systems are moving in this direction with online repositories and easy, interactive installation, but we still need to package our software intelligently. It will be interesting to see what the future holds and what new problems result for packaging and distribution in the age of the cloud.

As we pull files directly from online repositories on-demand we will see a bunch of new problems? Malware, spoofing and injection? (already problematic, but could get worse). Remote files deleted without warning (to get rid of vulnerable releases that should no longer be used - leaving users stranded)? Certificate and signature problems? Firewalls & proxy issues? Auto-magic updates with unfortunate bugs hitting everyone immediately and unexpectedly? And the fallacies of the network and other factors as linked to above. Beats me. We will see.

OK, it became a rant as usual - and that last paragraph is heading over board with speculation (and some of the issues already apply to current deployment). Sorry about that. But do try to get management approval to use an existing packaging & deployment solution is my only advice.

Stefan Kruger's Installsite.org twitter feed: https://twitter.com/installsite

Some recent highlights:


Choosing a deployment tool:

SE_net4 the downvoter
  • 21,043
  • 11
  • 69
  • 107
Stein Åsmul
  • 34,628
  • 23
  • 78
  • 140
  • Thank you for the detailed answer. I learned a lot! – Mehran Balaei Apr 19 '18 at 05:08
  • Glad you liked it. It morphed from a piece on deployment technology into the general issue of software distribution over the wire and the future with "cloud deployment". Not at all what you asked :-), but I hope it helped to make a decision for your deployment. – Stein Åsmul Apr 19 '18 at 05:14
  • So I think based on our situation (We are a team of three developers and we have to take care of everything ourselves, so we can't have someone to only take care of installer), we should use an installer tool, but we are not using the right one. We are using InstallAware and our installer is very large (over 19,000 lines) and it has not been designed properly overtime. And every now and then it fails with errors like "Invalid pointer" which doesn't give us any info and we have to spend days to find out where the script file is corrupted! – Mehran Balaei Apr 19 '18 at 05:15
  • You could try to use WiX - it is fiddly, but developer friendly in some ways. You can decompile the MSI built with InstallAware with the WiX tool `dark.exe`. Then you can clean up the de-compiled WiX source file in XML format and use it to make a WiX-based MSI in the future. Not at all problem free, but quite possible. Are you somewhat familiar with Wix? (I have to leave now). – Stein Åsmul Apr 19 '18 at 05:18
  • I know a bit about it, but not much. – Mehran Balaei Apr 19 '18 at 05:20
  • I have added some links for you at the bottom of the above answer. Maybe have a skim of a couple of them at least. [**See this answer for more on dark.exe**](https://stackoverflow.com/questions/48482545/how-can-i-compare-the-content-of-two-or-more-msi-files/48482546#48482546) (a bit down the page). – Stein Åsmul Apr 19 '18 at 05:21