Announcement

Collapse
No announcement yet.

How to change install location of a file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change install location of a file

    In the 2.0.1 version of my installer, I had a file, IMGSRVR.INI installed to: [ProgramFilesFolder]\ProducePro\Scanning
    In the 2.0.2 version of my installer I changed the destination to:
    [CommonAppDataFolder]\ProducePro\Scanning

    When I install a fresh copy of 2.0.2, IMGSRVR.INI goes to the correct destination folder. However, If I try to install 2.0.2 over 2.0.1, this file does not seem to get installed. How can I make sure the file will be installed to [CommonAppDataFolder]\ProducePro\Scanning if it does not exist there already? Even better yet, how can I move an existing copy of the file from [ProgramFilesFolder]\ProducePro\Scanning to [CommonAppDataFolder]\ProducePro\Scanning? Thanks.

  • #2
    Originally posted by PPro View Post
    How can I make sure the file will be installed to [CommonAppDataFolder]\ProducePro\Scanning if it does not exist there already? Even better yet, how can I move an existing copy of the file from [ProgramFilesFolder]\ProducePro\Scanning to [CommonAppDataFolder]\ProducePro\Scanning? Thanks.
    I assume that you are using the same component id for both files, in ProgramFiles and CommonAppData... As Windows Installer compares the existence of components on the target computer, the "new" file may not be installed, as the component already exists.

    For moving the existing file, you can use the "File Operations > Copy Files" action. Check the "Remove source" option, and the file will be moved. In order to perform this action only if there actually is an existing file, you could perform a search ("Project > Searches") and use the Property set by this as a condition on the "Copy Files" component.

    Ulrich

    Comment


    • #3
      Ulrich, Thanks for the help. I'm still struggling with this. I removed the IMGSRVR.INI from my project, then added it back so that it gets a new GUID, and it still doesn't get installed when I upgrade from my old 2.0.1 version to my new 2.0.2 version. Also my Copy Files operation isn't getting executed. Can you take a glance at my project files attached and see if you know what I did wrong?

      msi-project.zip

      Comment


      • #4
        It might be a good idea to process the MSI with a verbose log (command line option /lv) and see in the resulting log file if there are any hints while the file is being skipped.

        Ulrich

        Comment


        • #5
          I tried that.

          Code:
          msiexec /i "PProScanning.msi" /L*V "C:\output.log"
          But it gives the dialog "Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel". When I run the exe I don't get that message. How do I allow an update using the MSI?

          Comment


          • #6
            So you are using a bootstrapper? In that case, you need to pass the same command line arguments you use in the bootstrapper script, in addition to the verbose log option. Possibly something like

            Code:
            msiexec /i "PProScanning.msi" REINSTALL=ALL REINSTALLMODE=vomus /L*V "C:\output.log"
            might work.

            Ulrich

            Comment


            • #7
              I'm using the standard bootstrapper. I tried that command and do get further. The installation dialog gets stuck at "Status: Registering product" and a dialog appears that says "The specified account already exists". I'm attaching the log.

              output.txt

              I only see one entry for IMGSRVR.INI:

              Code:
              MSI (s) (EC:00) [13:34:13:331]: Component: IMGSRVR.INI; Installed: Absent;   Request: Null;   Action: Null
              It should have been installed to COMMONAPPDATA which is C:\ProgramData\ProducePro\Scanning\, but it was not.

              Comment


              • #8
                Could you please strip your original projects of all files, leaving just the INI, being placed into one folder in the first version, and into another in the second version? With the two working sample projects, I may be able to see what is happening and how to make this migration work.

                Ulrich

                Comment


                • #9
                  Ulrich, I'm attaching the project files you requested. Sorry this took so long!

                  ScanningApplication.zip

                  Run the 2.0.1 installer first, put in a dummy value when it prompts for the host name. It should place IMGSRVR.INI in C:\Program Files (x86)\ProducePro\Scanning.

                  Next run the 2.0.2 installer. It is supposed to place the IMGSRVR.INI file in C:\ProgramData\ProducePro\Scanning. The goal is to move IMGSRVR out of Program Files if it exists there from the 2.0.1 installer, and put it in Program Data instead.

                  Thanks!

                  Comment


                  • #10
                    Ok, thanks for the files. You have a slight problem here, I'll try to explain.

                    You want to perform a Minor Upgrade, as you aren't changing the ProductCode, but you assigned a new ProductVersion. However, in such a situation, you aren't allowed to change the ComponentCode of an existing component or place it into a different location, you will need to perform some kind of workaround.

                    One possibility is to include a new copy of the file in the MSI, and assign it a new ComponentCode. This new file can be deployed directly into the new location (CommonAppData). However, the old file better remains untouched - you cannot move or delete it. As you are applying a minor upgrade, you will need to work in maintenance mode, which first will recover any missing / corrupted files from the original/cached MSI package, before the new files are deployed. So if you delete or move the file, during the maintenance session it will be recovered... again. Without using a Custom Action to work around this, you won't be able to tackle this.

                    I have attached the two possible methods here. One uses a Custom Action to create the copy of the INI file in CommonAppData, using the source in ProgramFiles. This method assigns a new location to the existing ComponentCode. The other project does not use a Custom Action, but will deploy the file contained in the MSI in the new location. The old file is kept in the MSI, and a new ComponentCode is assigned to the copy in the new folder.

                    In any way, both methods require the change in the bootstrapper I mentioned in my earlier post. Please check the attached zips and test them.

                    Ulrich
                    Attached Files
                    Last edited by Ulrich; 02-12-2016, 06:22 PM.

                    Comment


                    • #11
                      Thanks! I will try these out.

                      Comment


                      • #12
                        I used the custom action one and it worked great! Thanks again!

                        Comment

                        Working...
                        X