Setup & Deployment project
For my .Net desktop apps I usually create an MSI installer (I create a 2nd project in my solution, a Setup & Deployment project) and I zip the setup.exe file with the <appname>.msi files together and put them up for download on my site. The installer will go through the process of asking where they would like to install the application (it creates the needed shortcuts and everything).
Right now I'm looking at adding a feature to some of these programs where it'll periodically check it's corresponding xml file on my web server and see if there's a newer version of itself available. I have this portion working just fine, where I'm stuck is that I would like to have it download a separate msi installer to update itself.
The idea is that it would download this different msi file, execute it while the app closes itself. This msi would not ask any questions, it would simply update the needed files in whatever location the first msi installer put the app. When this updater msi is done, it would just re-start the application.
How would I go about making an msi installer that doesn't have any prompts and installs the application where ever the first msi installer put it (where ever the user chose to install it to)?
Also, how do I have the installer launch the app before it closes itself?
Re: Setup & Deployment project
What I do is create a new "update project" in my solution which does the job. (no installer needed)
This is what is exactly does:
1) User clicks "chekc update"
2) Opens connection to database and reads the record (version number)
3) If app < then version number, then open "update project" and close the main app.
4) the "update project" downloads the files that are needed
5) once everything is replaced, "update project" terminates and executes the mainApp.
Re: Setup & Deployment project
Quote:
Originally Posted by
Radjesh Klauke
What I do is create a new "update project" in my solution which does the job. (no installer needed)
This is what is exactly does:
1) User clicks "check update"
2) Opens connection to database and reads the record (version number)
3) If app < then version number, then open "update project" and close the main app.
4) the "update project" downloads the files that are needed
5) once everything is replaced, "update project" terminates and executes the mainApp.
The reason I want to make an installer for the updates is so that the app version in windows gets updated & if the user goes to uninstall the app it'll remove everything because any new files from these update installed will all be registered under the app.
Re: Setup & Deployment project
Quote:
if the user goes to uninstall the app it'll remove everything
Isn't that the meaning of the uninstaller?
Quote:
because any new files from these update installed will all be registered under the app
What do you mean with registered?
Then the only thing that I can think of is:
1) if remote > localApp then execute downloader, terminate localApp
2) once file is downloaded (100%) run the update MSI (silent).
I don't know how to run it silent with the Package and Deployment. but once it is done it needs to start the app... Hmmm... Needs more thought.
Re: Setup & Deployment project
Quote:
Originally Posted by
Radjesh Klauke
Isn't that the meaning of the uninstaller?
Yes, if a future version of the app uses a different assembly (dll) or additional dll's I would like the windows uninstaller to remove it as well. If I make my own application to update the program, it would just copy the files and if they dont have the same names as the original installer, then windows will not know to remove it if the user uninstalls my app. Plus I would have to get into having my app gain Admin rights to update files in the %windir%\Program Files directly.
If I made a silent mode MSI installer I don't have to mess with any of the above, it would just work. So I'm asking how to make a silent msi installer.
I know it's possible as MS Updates downloads the individual MSI installers (the KB update files) and those execute silently.
Quote:
Originally Posted by
Radjesh Klauke
What do you mean with registered?
Then the only thing that I can think of is:
1) if remote > localApp then execute downloader, terminate localApp
2) once file is downloaded (100%) run the update MSI (silent).
I don't know how to run it silent with the Package and Deployment. but once it is done it needs to start the app... Hmmm... Needs more thought.
I plan to have the application itself download the MSI update installer then when the download is complete, execute it & the app closes itself. No separate updater app needed.
Re: Setup & Deployment project
When you download the files they will replace the older files, not renamed.
There is also the option, like I do, to use the specialfolders. Works like a charm. No admin-rights needed.
I only use INNOSETUP, perhaps you can use that also to create your silent installer. It isn't a MSI, but it works 100%.Perhaps you want to look at that.
Re: Setup & Deployment project
Making a "silent MSI installer" is easy - your existing MSI already is (assuming it doesn't require any user input other than accepting license agreements and selecting install directory).
All you need to do to install an MSI silently is use the right arguments with the MSIEXEC process. Just running msiexec /? at the command line will show you the options available but generally I just use "/qv". So you would download your MSI from your website, make your main app close itself, then have your updater app launch a process like so:
vb Code:
Process.Start("msiexec.exe", "/i C:\Path_To_Downloaded_MSI.msi /qv")
Job done :D
By the way that won't get around the fact that you'll still need admin permissions to update it, assuming its installed for all users.
Re: Setup & Deployment project
Quote:
Originally Posted by
chris128
Making a "silent MSI installer" is easy - your existing MSI already is (assuming it doesn't require any user input other than accepting license agreements and selecting install directory).
All you need to do to install an MSI silently is use the right arguments with the MSIEXEC process. Just running msiexec /? at the command line will show you the options available but generally I just use "/qv". So you would download your MSI from your website, make your main app close itself, then have your updater app launch a process like so:
vb Code:
Process.Start("msiexec.exe", "/i C:\Path_To_Downloaded_MSI.msi /qv")
Job done :D
By the way that won't get around the fact that you'll still need admin permissions to update it, assuming its installed for all users.
Did not know that, I'll play with it and see how it goes. But if I run the app in silent mode like that, is it going to pick up the path from the first installer? Or is it going to use the default path?
And I know about the admin rights, if the user doesn't have the rights to the folder then they'll be out of luck, it's moreso that when an admin is logged in the apps still do not have the permissions to the Program Files folder unless it goes through the app elevation process, installers do this automatically. It's moreso the updating of the version of the app in the windows registry and the uninstall programs applet int he control panel.
Re: Setup & Deployment project
Yeah if the user already installed it to a custom path it will pick up on that and use that if its an upgrade for an existing installed program.
As for updating the registry and Add/Remove Programs, its actually not that hard to do that yourself (see my post here to see where add/remove programs pulls this from in the registry) but I would recommend doing it the "proper" way with an MSI as you are planning to do
Re: Setup & Deployment project
Quote:
Originally Posted by
chris128
Yeah if the user already installed it to a custom path it will pick up on that and use that if its an upgrade for an existing installed program.
As for updating the registry and Add/Remove Programs, its actually not that hard to do that yourself (see my post
here to see where add/remove programs pulls this from in the registry) but I would recommend doing it the "proper" way with an MSI as you are planning to do
After playing with it for a while I've noticed that out of the box, it does not pick up a previously installed path. What it ends up doing is giving the user the option to change the path, but the value filled in is the default, and if you click next right through what ends up happening is it'll uninstall the previous version (I have this turned on, I know) then it installs the new version in the default location instead. After doing some reading it may be possible to use Orca to modify the msi file after it's been built to get it to pick up the previously installed path, but that's more work for each release & I haven't gotten it to work yet anyways.
What I'm doing now is I remove the destination path dialog from the UI sequence in VS, so the app will only be installed in the default location (user's program files folder) and all subsequent installs will be in the same location. Plus it's one less "next" for the users to click without paying attention anyways.