Visual C# Developer Center > Visual C# Forums > Visual C# General > Handling Installer Minor Revision Changes
Ask a questionAsk a question
 

QuestionHandling Installer Minor Revision Changes

  • Tuesday, November 03, 2009 10:13 PMjp2msft Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'm constantly pushing out small updates at our company due to some minor unforseen piece of the puzzle that is discovered during the manufacturing process. My application may change from 2.1.0.5 to 2.1.0.7 because I need to read in "6 text characters including the a space" instead of 5 characters like I was told. {sigh!}

    Anyway, I rebuild my application, rebuild my Setup and Deployment project (also part solution), then go out to reinstall it on 5 to 10 machines.

    Being a minor revision, the Setup and Deployment project fails stating that the current version is newer (actually it isn't, but that's the message I get). So, to install the patch, I have to log the person out, log in as an Administrator, remove the current version, install the modified version, log out, and let the other person log back in.

    How can I catch this message box before it displays? I am already overriding the Installer class to allow me to install the application as an Administrator for user accounts with restricted access ...I just can't install because of the minor update.

    Before the install, I would like some code to check what version is actually shown in the Add/Remove Programs settings and compare that to the version I am about to install. If my version is a minor update or greater (String.Compare(strNewVersion, strOldVersion) > 0), display a custom message asking if I'd like that version removed before proceeding. If No, the installation aborts.

    Where is a good place to look for this? Would this involve heavy MSI editing in ORCA, or is this something I could handle in the Installer's constructor? Any tips or ideas? Is there a better forum or different website I should look into? Is this beyond the scope & capabilities of Visual Studio 2008's Setup and Deployment?

    Thanks,
    ~Joe

    Avoid Sears Home Improvement

All Replies

  • Tuesday, November 03, 2009 11:09 PMStephen Cleary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'm not that familiar with the "Setup and Deployment project" in VS. I've converted to WiX some time ago. That said... I believe the Setup project will create a simple bootstrapper (to install .NET and other prerequisites), and then kicks off an MSI file. I think that your Installer code becomes custom .NET actions in that MSI.

    The dialog box you're seeing is thrown up when the MSI gets invoked, which is before your Installer code. So this kind of checking would have to be done by the bootstrapper (e.g., writing your own bootstrapper). Possible but quite difficult.

    The underlying reason is that the fourth version number is ignored by Windows Installer: http://msdn.microsoft.com/en-us/library/aa370859(VS.85).aspx

           -Steve

    Programming blog: http://nitoprograms.blogspot.com/
      Including my TCP/IP .NET Sockets FAQ

    Microsoft Certified Professional Developer
  • Wednesday, November 04, 2009 7:06 PMjp2msft Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I understand the forth version number is ignored by Windows Installer, which is why I'd like to (somehow) determine what the full version number for an installation is.

    Is there a way to say, "Is Product X installed?"

    If so, then ask, "What version of Product X is installed?"

    - Joe

    Avoid Sears Home Improvement
  • Wednesday, November 04, 2009 8:09 PMStephen Cleary Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    MSI exports an API that includes this functionality. I've never used it; it's entirely unmanaged, with no .NET wrappers AFAIK.

            -Steve
    Programming blog: http://nitoprograms.blogspot.com/
      Including my TCP/IP .NET Sockets FAQ

    Microsoft Certified Professional Developer
  • Thursday, November 05, 2009 2:30 AMjp2msft Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    MSI exports an API that includes this functionality. I've never used it; it's entirely unmanaged, with no .NET wrappers AFAIK.

            -Steve

    That's what I would have guessed, and that's one of the things I'd like to learn about on here. Any help with what it is called would be appreciated.
    Avoid Sears Home Improvement