1

I want to distribute an application (simple one exe file) so that a user installs it once and it'll be installed for all user accounts on that computer. And it should be done without Wix / InstallShield / Setup-project. (Clickonce doesn’t even support multi-user installations.)

How is it done? Registry edit (Which one?), Manually create an msi file (How? Is there a reference guide for that?)?

Edit

My question is not how to have some command execute at installation time. The question is about how does Windows know which applications are installed.

ispiro
  • 26,556
  • 38
  • 136
  • 291
  • Probably, you must write your own installer. – Hamlet Hakobyan May 13 '14 at 13:39
  • *Distribute* means *installing*. If you don't want to use existing installer, then: 1) you can make own installer 2) you can make application what doesn't required installation (could also be *portable* edition). – Sinatr May 13 '14 at 13:43
  • @Sinatr Not installing would not allow it to be used from the command line, for example. – ispiro May 13 '14 at 13:46
  • Is there a reason you want to reinvent the wheel instead of using an existing, well tested wheel known to work? – nvoigt May 13 '14 at 13:49
  • 1
    Based on question edit, you better explain what you need. Typical installer job is to ensure what software is ready to run. You can make program what will run in any case (even if components are missing, by, to example, using bootstrap) and will configure itself even if started from USB-stick on another PC. If you need something to be available in command line, then your exe-file location has to be in [`PATH`](http://stackoverflow.com/q/185208/1997232) or near `cmd.exe` itself. – Sinatr May 13 '14 at 13:57
  • @nvoigt Yes. The **setup project** wheel is unavailable in VS Express, and the other wheels (mostly the highly acclaimed **WIX**) have a steep learning curve. [I agree with this comment](http://stackoverflow.com/questions/12378125/create-msi-or-setup-project-with-visual-studio-2012#comment24607513_12382713) . – ispiro May 13 '14 at 13:58
  • Well, you have to learn something new once in a while. Setup projects were discontinued. Learning to create an MSI faking executable yourself seems silly when you could learn to use WiX (or an alternative, somehow you ruled them all out) instead. – nvoigt May 13 '14 at 14:15

3 Answers3

3

There are basically two ways to install an application in Windows. Let me call them the old way and the new way.

The old way

You need to manually perform the following steps:

  • Copy all required files to a location accessible by all users, such as C:\Program Files\YourApplication (or \Program Files (x86), if it's a 32-bit application on 64-bit Windows).

  • Install and register all prerequisites (such a the .NET Framework).

  • Create start menu and/or desktop icons for all users by placing them in the appropriate location. For example, for Windows 7 this would be C:\ProgramData\Microsoft\Windows\Start Menu\Programs and C:\Users\Public\Desktop.

  • (Optional) Create an executable that reverses all the above steps (e.g. uninstall.exe), copy it to your program files subdirectory and create an entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall that points to this unstallation exe. This will allow users to uninstall your application.

This is how it has been done for ages. Windows does not know which applications are installed, it just knows which applications can be uninstalled.

The new way

You provide an MSI file, which is basically a database containing information about your software and how it should be installed and let Windows Installer do all the work. Windows 2000 was the first operating system to include Windows Installer out-of-the-box.

Windows Installer does keep track of installed programs, which allows it to do useful stuff such as

  • determining whether a patch fits the installed version,
  • re-install missing files that have accidentally been removed,
  • etc.

Note that the Windows Installer configuration data is not easily accessible, so you cannot just add a few registry entries to "register" your application with Windows Installer. If you want Windows Installer, you need an MSI file.

The MSI format is quite complex, however, which is why tools such as InstallShield, WiX, etc. have been developed. WiX, for example, is basically a XML -> MSI conversion tool. It's still very close to the MSI structure but simplifies a lot of things. (Yes, WiX is complex, but MSI even more so.)

Community
  • 1
  • 1
Heinzi
  • 167,459
  • 57
  • 363
  • 519
  • Actually I'd argue that you have the old way and the new way reversed. The old way (1999) was to create a proper installer to do all that. These days all the fresh outs don't have a darn clue how to do that and they reinvent the wheel with new implementations of what you call the "old way". – Christopher Painter May 13 '14 at 18:18
  • @ispiro- There are "installed" programs. MSI has rich component, feature, product registration metadata that is instrumented through Win32 API and WMI. I can tell you exactly what is installed where in my 300,000 machine environment if you are using a properly authored MSI. – Christopher Painter May 13 '14 at 18:20
0

There is a really powerful open source script-based application to build installer projects. it is called NSIS. you can find it here http://nsis.sourceforge.net/Main_Page

You can simply specify your exe file , from where to take it and where to install it. A comprehensive documentation is also provided within the above link.

Aram Tchekrekjian
  • 925
  • 11
  • 26
-1

I'm not sure it'll be helpful in your case but you can create a logon script. This script will run once the user login to domain.

Please follow this link for details: logon script

Gal Ziv
  • 6,890
  • 10
  • 32
  • 43