Check version before Reinstalling RRS feed

  • Question

  • Hi everybody,


    I am creating a setup project for a window application in Visual Studio 2005.

    I have to check version and user rights in case the setup is run for repair or reinstall.


    Am all new in this…………

    Any help will be appreciated


    • Moved by YiChun Chen Tuesday, January 26, 2010 2:44 AM Deployment issue (From:Visual Studio 2010 Install and Setup)
    Monday, January 25, 2010 12:07 PM

All replies

  • Hi Reetika,

    I am moving this thread from Base "Visual Studio 2010 Install and Setup" forum to the "ClickOnce and Setup & Deployment Projects" forum, since the issue is related to deployment. There are more deployment experts in the "ClickOnce and Setup & Deployment Projects" forum.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, January 26, 2010 2:44 AM
  • Not sure why you need to check user rights, only admins can install/uninstall. You can write custom actions to check previously installed versions (call MsiLocateComponent and pass product code to get the install state)

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Tuesday, January 26, 2010 6:31 AM
  • You don't get to decide that. The way it works is that if you install something from an MSI file and then attempt to install that same MSI file again it *will* go into Repair or Remove mode, showing you that dialog.  If a user right-clicks the MSI and chooses repair, then that's what it will do.  These setups don't let you run custom actions to do anything about this. Why do have to check version and user rights exactly? What problem are you trying to solve?
    Phil Wilson
    Tuesday, January 26, 2010 9:56 PM
  • Thank you all for your reply...

    The whole story is I ve two projects one is window application and other is a service.

    I ve to install both.

    And if the msi run again, it sud

    1. Check for the service and stop the service if it is running
    2. Check for the exe
    3. If exe version is older it sud upgrade it
    4. Restart the service.


    And for this I thought I need to set the user rights

    Wednesday, January 27, 2010 5:15 AM
  • The way you upgrade an existing install is to use RemovePreviousVersions, after incrementing the Version property of your setup project. It will automatically upgrade it if necessary, and replace files that have lower versions.  As I said, you cannot just run the same MSI again.  You seem to be asking to do something that already exists - RemovePreviousVersions - that removes eearlier versions of the product, and upgrades older versions of the files.

    Do you have a program that is running one MSI then the other? Are are you just wanting to install one MSI file then the other?

    Phil Wilson
    Wednesday, January 27, 2010 7:39 PM
  • i am told that user will directly run the msi, for installation.
    i tried REmovePreviousVersion it is working fine but i have to stop the service before upgarding the software, can't we do this using Installer class?

    kindly suggest something...
    Thursday, January 28, 2010 2:45 AM
  • i solved few of my problems, i can register service and stop it in


    () &  OnBeforeInstall() and start it in OnAfterInstall().
    but i don't know how to install window exe from installer class

    Thursday, January 28, 2010 4:09 AM
  • Hi Reetika,

    What is the progress of your issue? You said some of the problems are solved. Could you let us know what issues are not solved yet?

    Aland Li
    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    Thursday, January 28, 2010 2:06 PM