EaranMaleasi
EaranMaleasi

Reputation: 925

InnoSetup takes wrong files

Today i encountered an odd problem. In the Files Section i have two different .exe files, which are copied into the temp folder to do some stuff, and then disappear at installation time. All worked fine until the compiler took a version of my .exe and decided, that it won't take any other version of it. I recompiled it several times, deleted all Temp folder entries belonging to InnoSetup, restartet the PC, placed the new version of my .exe in another path and added it to the Setup, i even deleted all Versions of this .exe and built a new one, but nothing helped. InnoSetup refuses to take another Version of this .exe whatever i do.

Well then, here some Code:

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"

[Components]
Name: "Client"; Description: "Client"; Types: Client Full;
Name: "Database"; Description: "Database preparation"; Types: Full;

[Types]
Name: "Full"; Description: "Full Installtion (Client and Database)"
Name: "Client"; Description: "Client Only (Database needed)";

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked;

[Files]
Source: "C:\MM-DISTRIBUTION\Client\Client.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\MM-DISTRIBUTION\Client\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\MM-DISTRIBUTION\MySqlDbCreation.exe"; DestDir: "{tmp}"; Flags: dontcopy
Source: "C:\MM-DISTRIBUTION\ClientCopyData-20140722-1208.sql"; DestDir: "{tmp}"; Flags: dontcopy
Source: "C:\Users\d.volz\Documents\Visual Studio 2010\Projects\XMLAndIniReplacer\XMLAndIniReplacer\bin\Release\XMLAndIniReplacer.exe"; DestDir: "{tmp}"; Flags: dontcopy

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]
var
  DBPage: TInputQueryWizardPage;
  Database: bool;

procedure InitializeWizard;
begin
  DBPage := CreateInputQueryPage(7, ExpandConstant('{cm:DBPageHeader}'), ExpandConstant('{cm:DBPageSubHead}'), ExpandConstant('{cm:DBPageDescription}'));
  DBPage.Add(ExpandConstant('{cm:DBPageServ}'), False);
  DBPage.Add('Port:', False);
  DBPage.Add(ExpandConstant('{cm:DBPageUserName}'), False);
  DBPage.Add(ExpandConstant('{cm:DBPagePass}'), True);

  DBPage.Values[0] := GetPreviousData(ExpandConstant('{cm:DBPageServ}'), '');
  DBPage.Values[1] := GetPreviousData('Port:', '');
  DBPage.Values[2] := GetPreviousData(ExpandConstant('{cm:DBPageUserName}'), '');
  DBPage.Values[3] := GetPreviousData(ExpandConstant('{cm:DBPagePass}'), '');

  ExtractTemporaryFile('MySqlDbCreation.exe');
  ExtractTemporaryFile('ClientCopyData-20140722-1208.sql');
  ExtractTemporaryFile('XMLAndIniReplacer.exe');
end;


procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode : Integer;
begin
    if CurStep=ssPostInstall then begin
        Exec(ExpandConstant('{tmp}') + '\XMLAndIniReplacer.exe',ExpandConstant('{app}')+'\Client.exe.config'+ ' ' +DBPage.Values[0] + ' ' + DBPage.Values[1] + ' ' + ExpandConstant('{app}')+'\Client.ini' + ' ' + ExpandConstant('{language}'),'', SW_SHOW, ewWaitUntilTerminated, ResultCode) 
    end;       
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpSelectComponents then begin
  end;
end;


function NextButtonClick(CurPageID: Integer): Boolean;
  var
    ResultCode: Integer;
  begin
    Result := True;
    if CurPageID = DBPage.ID then begin
      if DBPage.Values[0] = '' then begin
        MsgBox('You must enter the server name or address.', mbError, MB_OK);
        Result := False;
      end else if DBPage.Values[1] = '' then begin
        MsgBox('You must enter a port, even the default one.', mbError, MB_OK);
        Result := False;
      end else if DBPage.Values[2] = '' then begin
        MsgBox('You must enter the user name.', mbError, MB_OK);
        Result := False;
      end else if DBPage.Values[3] = '' then begin
        MsgBox('You must enter the user password.',mbError,MB_OK);
        Result := False; 
      end else if Database then begin
        if MsgBox('Database will now be prepared for Client. Continue?',mbConfirmation,MB_OKCANCEL) = IDOK then begin
          if Exec(ExpandConstant('{tmp}') + '\MySqlDbCreation.exe', DBPage.Values[0] + ' ' + DBPage.Values[1] + ' ' + DBPage.Values[2] + ' ' + DBPage.Values[3] + ' ' + ExpandConstant('{tmp}') + '\ClientCopyData-20140722-1208.sql', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
            if ResultCode = 0 then begin
              MsgBox('Database was created successfully. Clientcan now be installed',mbInformation,MB_OK);
              Result := True;
            end else if ResultCode = 1 then begin
              if MsgBox('Could not create database for Client. Do you wish to proceed the setup anyway? Client can not be used without a database.',mbError,MB_YESNO) = IDYES then begin
                Result := true;
              end else begin
                Result := false;
              end;
            end else if ResultCode = 2 then begin
              if MsgBox('Could not connect to the Database. Do you wish to proceed the setup anyway? Client can not be used without a database.',mbError,MB_YESNO) = IDYES then begin
              Result := True;
              end else begin 
              Result := false;
              end;
            end else begin
              MsgBox('Invalid number of Arguments',mbError,MB_OK);
              Result := false;
            end;
          end;
        end else begin
          if MsgBox('Client can not be used without a prepared database. Do you wish to continue the setup anyway? ',mbError,MB_YESNO) = IDYES then begin;
          Result := true;
          end else begin
          Result := false;
          end;
        end; 
      end; 
    end;
  end;

MySqlDbCreation and XmlAndIniReplacer are two little C# Consoles.

Whatever i do, InnoSetup takes a version of XmlAndIniReplacer which i don't even have anymore instead of the one specified in the Files Section. Also it won't recognize the Flag dontcopy, which means, i can find the Console in the Application Folder. Whats wrong here?

Compiler:

*** Starting compile.  [16:46:00]

[ISPP] Preprocessing.
[ISPP] Preprocessed.

Parsing [Setup] section, line 14
Parsing [Setup] section, line 15
Parsing [Setup] section, line 16
Parsing [Setup] section, line 18
Parsing [Setup] section, line 19
Parsing [Setup] section, line 20
Parsing [Setup] section, line 21
Parsing [Setup] section, line 22
Parsing [Setup] section, line 23
Parsing [Setup] section, line 24
Parsing [Setup] section, line 25
Parsing [Setup] section, line 26
Parsing [Setup] section, line 27
Parsing [Setup] section, line 28
Reading file (WizardImageFile)
   File: C:\Program Files (x86)\Inno Setup 5\WIZMODERNIMAGE.BMP
Reading file (WizardSmallImageFile)
   File: C:\Program Files (x86)\Inno Setup 5\WIZMODERNSMALLIMAGE.BMP
Preparing Setup program executable
Reading default messages from Default.isl
Parsing [Languages] section, line 31
   File: C:\Program Files (x86)\Inno Setup 5\Default.isl
Parsing [Languages] section, line 32
   File: C:\Program Files (x86)\Inno Setup 5\Languages\German.isl
Parsing [LangOptions], [Messages], and [CustomMessages] sections
   Messages in script file
Reading [Code] section
Parsing [Types] section, line 39
Parsing [Types] section, line 40
Parsing [Components] section, line 35
Parsing [Components] section, line 36
Parsing [Tasks] section, line 43
Parsing [Tasks] section, line 44
Parsing [Icons] section, line 53
Parsing [Icons] section, line 54
Parsing [Icons] section, line 55
Parsing [Icons] section, line 56
Parsing [Run] section, line 59
Parsing [Files] section, line 47
Parsing [Files] section, line 48
   Reading version info: C:\MM-DISTRIBUTION\MySqlDbCreation.exe
Parsing [Files] section, line 49
   Reading version info: C:\MM-DISTRIBUTION\ClientCopyData-20140722-1208.sql
Parsing [Files] section, line 50
   Reading version info: C:\Users\d.volz\Documents\Visual Studio 2010\Projects\XMLAndIniReplacer\XMLAndIniReplacer\bin\Release\XMLAndIniReplacer.exe
Compiling [Code] section
Deleting ClientSetup.exe from output directory
Creating setup files

   Compressing: Intensifies...

   Compressing: C:\MM-DISTRIBUTION\MySqlDbCreation.exe   (1.0.0.0)
   Compressing: C:\MM-DISTRIBUTION\ClientCopyData-20140722-1208.sql
   Compressing: C:\Users\d.volz\Documents\Visual Studio 2010\Projects\XMLAndIniReplacer\XMLAndIniReplacer\bin\Release\XMLAndIniReplacer.exe   (1.0.0.0)
   Compressing Setup program executable
   Updating version info

*** Finished.  [16:46:22, 00:21,809 elapsed]

Upvotes: 1

Views: 1285

Answers (1)

Ken White
Ken White

Reputation: 125651

It appears InnoSetup is finding information in a cache somewhere, noticing that the version hasn't changed, and is using that cached copy instead because it's already compressed and can save time.

Here's a way to fix it:

Build your setup. Use the Compiler Output window (View->Compiler Output) to see exactly what files are being included. You should check both the Parsing [Files] and Compressing: sections of that output. Note the exact path and filename it's using for the file(s) that are the issue.

Rename the problem file, both in the folder it's in and in the [Files] section in your installer script. Build the installation again, and check the compiler output to make sure it picked up the renamed file when it was parsing.

Change the script and file back to their original names. It should now start using the new version of the file as you originally wanted.

Upvotes: 2

Related Questions