今天我遇到了一个奇怪的问题。 在文件部分我有两个不同的.exe文件,它们被复制到临时文件夹中做一些事情,然后在安装时消失。一切正常,直到编译器使用我的.exe版本并决定,它不会采用任何其他版本。我重新编译了几次,删除属于InnoSetup的所有Temp文件夹条目,重新启动PC,将我的.exe的新版本放在另一个路径中并将其添加到安装程序中,我甚至删除了此.exe的所有版本并构建了一个新的一,但没有任何帮助。无论我做什么,InnoSetup拒绝接受这个.exe的另一个版本。
那么,这里有一些代码:
[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和XmlAndIniReplacer是两个小C#控制台。
无论我做什么,InnoSetup都会使用XmlAndIniReplacer的版本,我甚至不再使用文件部分中指定的版本。它也不会识别Flag dontcopy,这意味着,我可以在Application Folder中找到Console。这有什么不对吗?
编译器:
*** 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]
答案 0 :(得分:2)
似乎InnoSetup正在某个地方的缓存中查找信息,注意到版本没有更改,并且正在使用该缓存副本,因为它已经被压缩并且可以节省时间。
这是解决问题的方法:
构建您的设置。使用“编译器输出”窗口(视图 - >编译器输出)可以准确查看所包含的文件。您应该检查该输出的解析[文件] 和压缩:部分。请注意它用于问题的文件的确切路径和文件名。
重命名问题文件,包括它所在的文件夹以及安装程序脚本中 [Files] 部分。再次构建安装,并检查编译器输出以确保它在解析时获取重命名的文件。
将脚本和文件更改回原始名称。它现在应该开始使用您最初想要的新版本文件。