Search code examples
delphitms

Delphi XE3: TWebUpdate by TMS software: does not replace main exe-file


to update my applications I'm using TWebUpdate by TMS software:

WebUpdate1.URL:='http://myserver.com/update.inf';
if WebUpdate1.NewVersionAvailable then
begin
case Application.MessageBox(PChar('The new version '+WebUpdate1.NewVersionInfo+' is available! Update it?'), 
'Updates Are Available', MB_YESNO + MB_ICONQUESTION) of
  IDYES:
    begin
     SetCurrentDir(ExtractFilePath(Application.ExeName));
     WebUpdate1.DoUpdate;
     WebUpdate1.DoRestart;
    end;
  IDNO:
    begin
      Application.Terminate;
    end;
end;

Here is the update.info file:

[update]
newversion=2.1.0.37
localversion=client_app.exe
[files]
count=1
[file1]
url=http://myserver.com/client_app.exe
newversion=2.1.0.37
localversion=client_app.exe
mandatory=1
[application]
appupdate=1
silentrestart=1
appname=client_app.exe
appcomps=client_app.ex_

Actually, the update works fine (the exe-file is downloaded and the application is restarted), but the exe-file is not replaced by downloaded file. Where may be a problem? Thanks in advance.


Solution

  • It turned out that the downloaded file MUST be compressed as cab-file. That is:

    [update]
    newversion=2.1.0.37
    localversion=client_app.exe
    [files]
    count=1
    [file1]
    url=http://myserver.com/client_app.ex_
    newversion=2.1.0.37
    localversion=client_app.exe
    mandatory=1
    [application]
    appupdate=1
    silentrestart=1
    appname=client_app.exe
    appcomps=client_app.ex_
    

    And of course:

    WebUpdate1.ExtractCAB:=True;