none
"another version of this product is already installed" RRS feed

  • Question

  • I thought I had this sorted out but it appears that the VS2008 generated MSI behavior is different from the IDE compared to just running the MSI.
    I researched my problem in this forum but am more confused now than when I started.  Plus all the posts were VS2005 and earlier.

    I am changing code and versions and such in the application assemblies but not changing any of the values of the Setup project.

    If I have DetectNewInstalledVersion=False and RemovePreviousVersions=True, AND right-click Install from the IDE, then a small progress dialog appears while the "previous" version is removed before the "current" version is installed.   This the exactly behavior I want.

    BUT, if I immediately run setup.exe or the MSI I get the dreaded "Another version of this product is already installed..." dialog.

    If I try the proposed solution, i.e. increment the version and change the Product Code, then the installation completely ignores the fact that a previous version is installed.

    1) how is it that Install from the IDE works differently from the MSI?
    1) is it really possilble to configure MSI to automatically remove whatever version is currently installed?  how exactly is this done? (please explain as I have read the 5 similar questions along with hits for DetectNewInstalledVersion and RemovePreviousVersions - none of these seem to really answer the question)
    Tuesday, May 12, 2009 9:17 PM

Answers

  • Visual Studio 2005's RemovePreviousVersions behaved as a full install of the older product and a fresh install of the new setup. Visual Studio 2008's RemovePreviousVersions also removes the older *product* (so Add/Remove Programs shows the new one) but at the file level the version rules are followed, so you're right, files will not be updated unless the file versions have been incremented.  I think the idea behind this is that when people install databases you don't want an upgrade to remove that database (which is what happened on VS 2005). It's also a bit more efficient in the case that you have hundreds of files but you only need to update a couple, so you just rebuild those, incrementing the version, and then they will be the only files updated. 

    It's normal in the setup world that you increment file versions when you want to replace existing files. This has been the way installs have behaved since years before .NET and Visual Studio setups, but if anyone is used to the way that VS 2005 RemovePreviousVersions works it's a bit of a surprise.  
    Phil Wilson
    • Marked as answer by megabitee Wednesday, May 20, 2009 1:43 PM
    Monday, May 18, 2009 8:28 PM
    Moderator

All replies

  • It's a requirement to increment the Version in the setup project, then accept the recommended changes. After that:
    RemovePreviousVersions true, but versions must all be greater than or equal 1.0.
    ProductCodes different between old and new.
    UpgradeCodes the same in old and new.
    InstallAllUsers the same in old and new.

    Your install from the IDE looks like it'a helping you out by automatically uninstalling the old version.


    Phil Wilson
    Tuesday, May 12, 2009 10:53 PM
    Moderator
  • 1) If I set RemovePreviousVersions=False and run Install from the IDE then the previous version is NOT uninstalled before the installation starts.
        If I set RemovePreviousVersions=True and run Install from the IDE then the previous version IS uninstalled before the installation starts.

    apparently Install from the IDE works very differently from running the MSI.  one would assume that the IDE would simply run setup.exe. perhaps it is sending a command line parameter? after reading the MSI spec I cannot make a switch cause the IDE behavior.

    2) following the published instructions:
       RemovePreviousVersions=True, Version=1.0.0 then 1.0.1, 1.1.0, 2.0.0
       ProductCodes are different because of "accept recommended changes"
       UpgradeCodes are the same
       InstallAllUsers are the same 

    When I run the MSI, the previous installation is completely ignored, all I see is the Welcome dialog.   I tried this 3 times changing the Version from 1.0.0 to 1.0.1, 1.1.0, and 2.0.0 (as suggested by another post http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/1bf05cb7-9afb-42ba-9f19-4b68985ead23/) and changing the product code each time.

    3) again, running Install from the IDE produces the desired behavior.  what command is the IDE executing?
    Wednesday, May 13, 2009 3:36 PM
  • It's not clear to me what you're expecting, but seeing a Welcome dialog when you install a new version is exactly what you're supposed to get. A RemovePreviousVersions update looks exactly like a fresh install except that behind your back it uninstalls the previous version.  The IDE behavior is just different - it helps you out by uninstalling whatever is already installed. It doesn't know or care if you have RemovePreviousVersions - it just knows you want to try the new one and it won't work if the older one is already installed so it uninstalls it.

    The behavior when you just run it and see the welcome dialog is what you get, and it's actually better - it is integrated with Windows in case there's an unexpected reboot, and the whole upgrade is transactional so that if the install of the new product fails it will roll back and leave you with the previous one installed. 


    Phil Wilson
    Wednesday, May 13, 2009 11:15 PM
    Moderator
  • I think you are being too technical.  Please try to understand.

    I simply want each successive installation to uninstall any prior installation.  How do I do this?

     


    Let’s examine this in more detail.  Assume that the software is installed.


    1) The solution is rebuilt with a new version number.  The setup is rebuilt but the version, product code, and upgrade code stay the same.

    Desired behavior: Uninstall the prior installation then install the current. 

    Actual behavior: “A previous version is installed…”

    Question 1:  Is the desired behavior possible?


    2) The solution is rebuilt with a new version number.  The setup is rebuilt with a new minor version (1.0.0 => 1.1.0), new product code, and same upgrade code.

    Desired behavior: Uninstall the prior installation then install the current. 

    Actual behavior: Welcome dialog

    Question 2:  Is the desired behavior possible?  Why would I install a minor version in parallel?


    3) The solution is rebuilt with a new version number.  The setup is rebuilt with a new major version (1.0.0 => 2.0.0), new product code, and same upgrade code.

    Desired behavior: Uninstall the prior installation then install the current. 

    Actual behavior: Welcome dialog

    Question 3:  Apparently this should actually work.  Any idea why not?

     
    • Edited by megabitee Thursday, May 14, 2009 8:11 PM
    Thursday, May 14, 2009 1:33 PM
  • In an effort to resolve this problem, I wrote a little utility called setup.exe... This utility calls msiexec to uninstall the "old" version then install the "new" version. 
    The commands are:

    msiexec /uninstall MySetup.msi /passive
    msiexec /i MySetup.msi

    I thought the first command was duplicating the IDE behavior, but it does not.  After I change the Setup version, the first command results in “A previous version is installed…”  Running Install or Uninstall from the IDE performs the same passive uninstall after changin the Setup version. 

    1) How do I duplicate the IDE behavior?

    2) Is there smoe way to just update the installation with new or changed assemblies?  I read some other threads about the change to update rather than uninstall in VS2008 but the the only MSI behavior I can seem to invoke is either passive uninstall, “A previous version is installed…”, or completely ignoring the fact that a previous version is installed.

    Friday, May 15, 2009 7:40 PM
  • RemovePreviousVersions will do what you want. It works if you set it up correctly, period. It uninstalls the older version after you've been through the Welcome dialogs etc because you might decide to Cancel in those dialogs, and if you've already uninstalled the old version then you're in trouble - you don't have the old version *or* the new version installed.  I don't understand if you've actually ever let this go through or not becauuse you seem to think that if you see a Welcome dialog it's broken, but it isn't.  All things being set up properly, this *will* replace your older product with the new one.

    If you don't like the way it works then sure, write your own program to do it. Don't set RemovePreviousVersions, and write your program to uninstall the old version using msiexec /x {old productcode guid} and then install your new one. Your current program isn't working, that's correct - what do you think msiexec to uninstall your new MSI file is going to do? Nothing! You're not uninstalling your new MSI file -  you want to uninstall the old one, so use /x {old product guid}. 

    Anyway I don't understand why you would write all this code to get something you can get for free which is safer, but it's your choice.

    The update mechanism Visual Studio provides is RemovePreviousVersions. Other tools can be used to build patch files (msp files) to update existing installed products. Office and Visual Studio are usually updated using patches, but they don't build their setups using Visual Studio setup projects. 
    Phil Wilson
    Friday, May 15, 2009 8:08 PM
    Moderator
  • Thanks for your response, Phil.   I've learned more in this post than reading all the others combined.

    I did not know, and did not understand, that the old version was removed at the end.  I got an inkling in one of your posts in another thread but it was not quite spelled out to me.  Please excuse my ignorance.  I've hunted through the documentation and forums over several days and still do not really understand VDPROJ and MSI behavior. 

    I always stopped at the Welcome dialog because I was used to how the Install/Uninstall behaved when run from the IDE.  I assumed that the Welcome dialog meant that the uninstall did not work.  It might be a feature but to me this is like programs behaving differently when run from the IDE.


    OK.  I ran it all the way through.  The new version was installed.  I was watching the directory durng the installation, it appears that it updating rather than uninstall/reinstall.  I read about all this but did not think it applied to me.  Now I will reread those posts with a new perspective.

    Does RemovePreviousVersions behave differently when the Setup version is changed from 1.0.0 to 1.0.X, 1.X.0, or X.0.0?

    Friday, May 15, 2009 9:15 PM
  • Visual Studio 2005's RemovePreviousVersions behaved as a full install of the older product and a fresh install of the new setup. Visual Studio 2008's RemovePreviousVersions also removes the older *product* (so Add/Remove Programs shows the new one) but at the file level the version rules are followed, so you're right, files will not be updated unless the file versions have been incremented.  I think the idea behind this is that when people install databases you don't want an upgrade to remove that database (which is what happened on VS 2005). It's also a bit more efficient in the case that you have hundreds of files but you only need to update a couple, so you just rebuild those, incrementing the version, and then they will be the only files updated. 

    It's normal in the setup world that you increment file versions when you want to replace existing files. This has been the way installs have behaved since years before .NET and Visual Studio setups, but if anyone is used to the way that VS 2005 RemovePreviousVersions works it's a bit of a surprise.  
    Phil Wilson
    • Marked as answer by megabitee Wednesday, May 20, 2009 1:43 PM
    Monday, May 18, 2009 8:28 PM
    Moderator
  • I have developed with other tools and installed with InstallShield since v3.0 so this is all new behavior for me.  Then when the IDE works in some other way it is all a surprise...At least now I know waht direction to look...


    When I set RemovePreviousVersions=FALSE I get multiple entries in Add/Remove Programs. Therefore I will set RemovePreviousVersions=TRUE.

    But, we have a service that is using some of the files which means I get "You must restart your system for the configuration changes mode to BeamGage Standard to take effect..."
    Any suggestions for how I can stop the service before the update?




    P.S. the search in this forum is broken.  this make it very difficult to find answers.  i can search the parent but searching this forum returns Error 500
    Tuesday, May 19, 2009 1:37 AM
  • Hi megabitee,

    To stop the service before installing, I think you can try to write an utility to check the specificity service is running, if so, stop it and invoke the setup.exe. Otherwise, invoke setup.exe directly.

    Best regards,
    Bruce Zhou
    Please mark the replies as answers if they help and unmark if they don't.
    Wednesday, May 20, 2009 7:26 AM
  • thanks for the idea.  I will look at that.

    I have already written a Custom Action that 1) adds and starts the service during installation, and 2) stops and removes the service when the software is uninstalled.  I am thinking I could run 2) before each new installation then 1) will run normally.

    I have tried without success to get a Custom Action to run early in the installation.  Is there some way to invoke a Custom Action or some custom application before files are copied?  this is a VS2008 Setup project and the solution must fit within that framework.

    Wednesday, May 20, 2009 1:55 PM
  • It might be hard to make the managed Custom Action to run before copying files. So I suggest you write a utility in my first response. Here, I'd recommend an article which may let know you more about Custom Actions.

    Besides, you can also refer to the MSDN documents for more resources.


    Best regards,
    Bruce Zhou
    Please mark the replies as answers if they help and unmark if they don't.
    Thursday, May 21, 2009 5:44 AM
  • i have similar kind of problem...


    I (my client) wants to reinstall over an existing installation. is it possilble to configure MSI to automatically  uninstall the existing (whatever version) and then install the 'new' version.I would like to be able to uninstall before the install and I can't seem to find out how. Any/all help would be greatly appreciated.

     

    Thanks

     


    Wednesday, October 5, 2011 12:22 AM
  • Hi Phil,

    I am also having the same issue.

    I have a setup project built with Visual studio 2015. For the current release, I have updated the version of my setup project from 2.4 to 2.5 which prompted me to change the product code (GUID) which is done and the upgrade code remains the same. RemovePreviousVersions  property is set to true.

    When i installed the newer MSI - it is throwing me the screen as shown in the image attached.


    Thanks & Regards Somu

    Tuesday, November 21, 2017 10:21 AM