BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Update but NOT remove existing files.

Mon Jul 23, 2018 11:05 am

Hi,

I have successfully created an install and update which installs a Windows PC program (plus pre-requisites) as well as updates over a SQL database keeping customer specific data entered into certain tables.
As expected this install / update is a fairly large file (due to pre-requisites).


I am now looking at creating an automatic update process (similar to the one by advanced Installer) which is predominantly a MS SQL data update. The MS SQL has data that can be updated on a weekly basis and I need to get this out to customers PC's.


I cannot replace the MS SQL database since there will be user data in some tables and I am looking a keeping the size of the update as small as possible (hence do not want to send out full database).

I am using bcp to help add data into temp SQL table and then run a user program as a Custom Action which will transfer data from temp tables to live tables. bcp works successfully in current install / update.

When I now create an update install, "with only the files changed as part of the latest version", the update process removes all required files since I do not want to have these defined in the update since they have not changed.

Question 1). Is there a way in the update to NOT have to define all files that the program needs and ONLY define the files that have changed?

ALSO
Was looking at using Requirements | Launch Conditions | Custom - ProductVersion >= "2.1.0.1" to force this update to have a specific version installed first. This check fails all the time and the update does not start - even thought version 2.1.0.1 is installed.
Question 2) is there some addition help on using Custom \ Launch Conditions.


I MAY have to update the main program and some dll's (and other files) at a later date.


Thanks,
Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Fri Jul 27, 2018 11:43 am

Hello Brian,
Question 1). Is there a way in the update to NOT have to define all files that the program needs and ONLY define the files that have changed?
I think that here you can use our support for Patches. Patches are usually much smaller than upgrades, as they only contain the diffs between the two different versions of the same product. However, they can only be installed on computers that have the previous version already installed.

If your package is of EXE type, you could also use the "Install MSI as minor upgrade (if applicable)" option from the "Bootstrapper Options" in "Builds" page, which is similar with those presented above.
Question 2) is there some addition help on using Custom \ Launch Conditions.
You can find some useful information about Custom \ Launch Conditions at the following "I add a custom condition to check if mysql installed,but why it no using" thread.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Re: Update but NOT remove existing files.

Fri Jul 27, 2018 12:51 pm

Catalin,

Thanks for response.

Will try your suggestions over the next week.

Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Fri Jul 27, 2018 1:09 pm

Hello Brian,

You're always welcome!

If you have any further questions or doubts, don't hesitate to contact me and I will gladly assist!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Re: Update but NOT remove existing files.

Mon Jul 30, 2018 8:54 am

Catalin,

Since my install is an .exe (cannot remember why exe and not msi - been a long time ago maybe security issue with major client).

Looks like I cannot use Patch install since I do not have a msi file - old or new!


Tried using Package Definition | Builds | Bootstrapper Options | Install MSI as minor upgrade (if applicable).

This did the same as my previous attempts in that it removed all the files NOT defined in Resources | Files and Folders.


Does the Product Information | Product Details | Version supposed to be the same as earlier install or a higher number? I have made it a higher number for the "patch".


Thanks,
Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Wed Aug 01, 2018 3:52 pm

Hello Brian,

Please keep in mind that if you are building a .EXE setup, you can still create patches by using the /extract command of the bootstrapper on your setup as it follows:

Code: Select all

YourPackage.exe /extract "LocationWhereFilesWillBeExtracted"
Where "LocationWhereFilesWillBeExtracted", as its name suggests, is the location where your .MSI and .CAB files will be extracted. For example, you can use a location like this:

Code: Select all

YourPackage.exe /extract "C:\MyFolder"
This way, the MSI contained by your EXE setup will be extracted to the specified location.

Does the Product Information | Product Details | Version supposed to be the same as earlier install or a higher number? I have made it a higher number for the "patch".
Yes, that should be a higher number, but please keep in mind that you should keep the existing Product Code, if you plan to create patches.

Also, please keep in mind that the process of creating patches is a sensitive process, so make sure you respect all the rules specified in the "Creating Patches". Also, having a look on our "Authoring a Windows Installer patch" may be helpful.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Re: Update but NOT remove existing files.

Mon Aug 06, 2018 12:53 pm

Catalin,

Thanks for reply but I am not sure where to go from here. I feel more confused.

I don't know how to take what you have said and create a patch for my exe installs.


Question - where in advanced Installer is CODE: SELECT ALL you mention in your post?


What I did try was:

I took my earlier install - say V2.1.0.1 and created a MSI install (not EXE).

I then updated two C# programs and created a V2.1.1.1 MSI install. In creating V2.1.1.1 I did not generate a new Product Code.

I followed instructions on how to create a patch, using the 2 MSI's and created patch V2.1.1.1.

I installed V2.1.0.1 and then tried to update with patch V2.1.1.1

When I run that patch I get error:
"The upgrade patch cannot be installed by the Windows Installer service because the program to be upgrade may be missing, or the upgrade patch may update a different version of the program. ……"


Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Mon Aug 06, 2018 1:44 pm

Hello Brian,
Thanks for reply but I am not sure where to go from here. I feel more confused.
I am sorry for the confusion made, I think I was not very clear in my worldling.
Question - where in advanced Installer is CODE: SELECT ALL you mention in your post?
What I have meant by that is that you can extract the .MSI out of your .EXE package using the /extract command line on your setup. In order to achieve this, you can open a new command line, travel to the folder that contains your .EXE setup file by using a change directory (cd) command and then apply the command line as I have described above.

For example, let's say your setup is located in D:\MyUser\MyApplication\MyApplication SetupFiles. To achieve those said above, you can follow this step-by-step:

1) open a new command line and travel to the directory which contains your setup file by using -> cd "D:\MyUser\MyApplication\MyApplication SetupFiles" (this is just the example we have used above)

2) there you can extract the .MSI out of your .EXE file using a command line as it follows:

Code: Select all

MyApplication.exe /extract "The location where the msi will be extracted"
If you do not specify any location, the .MSI will be extracted next to your .EXE setup file.

After doing so with both your old and new .EXE, you can use the MSIs from both to create a patch. For example, let's say you have two setups, v1.exe and v2.exe.

v1.exe --> extract v1.msi

v2.exe --> extract v2.msi

Use v1.msi and v2.msi to create a patch.

Also, please make sure that both of your project versions are fully compliant with patch creation rules.

In what regards this:
"The upgrade patch cannot be installed by the Windows Installer service because the program to be upgrade may be missing, or the upgrade patch may update a different version of the program. ……"
This is an error which is usually displayed when you are trying to install a patch on a system where the target image (MSI) of the patch is not installed.

If this still does not help, please send us the following projects:

1) old version .aip
2) new version .aip
3) patch project .aip

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Re: Update but NOT remove existing files.

Mon Aug 06, 2018 2:54 pm

Catalin,

Really appreciate quick reply.

Think I understand a bit better in creating MSI from EXE.

Since it is very late will try tomorrow but quick question.


When I create V2.exe I do so with the same Product code as V1.exe?


Thanks,
Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Mon Aug 06, 2018 3:29 pm

Hello Brian,

Yes, you will need to have the same ProductCode for both versions of your setup if you plan on creating a patch.

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

BCh
Posts: 63
Joined: Wed Jan 17, 2007 6:32 am
Location: Australia

Re: Update but NOT remove existing files.

Thu Jan 10, 2019 2:24 am

Time really flies. Didn't think it was so long since I looked at this.

I can now create a patch to cover updating of exe or dll's. I did this as per Tutorials | Patch Authoring and using msi files.


As my initial question also notes that I need to update (insert new rows or update existing ones) a sql database which has been already installed in previous version. I do not see how I can do this using patches.

While I have a solution I'm not totally happy since it requires a new product code and hence in installed programs (control panel) gives me 2 entries for the same program.

The solution I have is in effect installation of a new product and uses Custom actions to copy updated exe and dll.s to original program directory and then runs a C# progam to do the actual sql update.

Any suggestions on my solution, especially in using same product code without loosing original files that have not changed.
OR
a better solution to:
1) update changed exe and dll.s
2) run custom actions to update previously installed sql database.


Also how do I check if my program has already been installed prior to running my update / patch? Not sure if can use Requirements | Launch Conditions | Custom.
Did try using Custom Behaviour | Search - File version - File to find and using that search value in Custom | Launch Conditions.


Thanks,
Brian

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Update but NOT remove existing files.

Wed Jan 16, 2019 4:16 pm

Hello Brian,

First of all, I apologize for the delayed reply, but we were quite busy lately.
I can now create a patch to cover updating of exe or dll's. I did this as per Tutorials | Patch Authoring and using msi files.
I am really glad you succeeded in creating a patch for your .EXE setup.
As my initial question also notes that I need to update (insert new rows or update existing ones) a sql database which has been already installed in previous version. I do not see how I can do this using patches.
I think that this is possible in two ways:

1) You can run your C# custom action that updates the SQL Database during the patch. For more information about this, please have a look on our "How to create a patch that runs a custom action" article which I think you may find useful.

2) Available starting with an Enterprise suite or higher:

You can make use of the "Sql Databases" page.
Also how do I check if my program has already been installed prior to running my update / patch? Not sure if can use Requirements | Launch Conditions | Custom.
Did try using Custom Behaviour | Search - File version - File to find and using that search value in Custom | Launch Conditions.
That is a good approach. But I think that even better would be to use a registry search instead of a file version search. Your application always writes information under the registry hives. In order to use a registry search, you can proceed as it follows:

- Please go to "Search" page --> right click --> "New Search" --> right click on the newly created search --> "Add Search Location" --> "Registry".

Additional note: Due to a recently discovered issue in Advanced Installer, our support for "Extended Searches" does not work when used with "Custom Launch Conditions". If, as condition, the result of an extended search is used, the custom launch condition will always fail (even if the search is valid). This is now under investigation and hopefully a fix will be available in a future version of Advanced Installer.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”