【发布时间】:2014-07-25 14:08:23
【问题描述】:
今天我遇到了一个奇怪的问题。 在文件部分,我有两个不同的 .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 版本,而不是文件部分中指定的版本。它也不会识别标志 dontcopy,这意味着,我可以在应用程序文件夹中找到控制台。这里有什么问题?
编译器:
*** 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]
【问题讨论】:
-
已更新。希望现在更容易理解。
-
好多了。谢谢。 :-)
[Files]中的这条线应该做什么?Source: "C:\MM-DISTRIBUTION\Client\*";您已经从该文件夹中包含了Client.exe。它也有点不清楚你有什么问题。您提到了进入 temp 并在之后被删除的两个 .exe 文件,但随后继续谈论“我的 .exe”和“.exe”,我不知道它是否是进入的两个之一temp 或如果它是其他之一。 -
是的,但是还有一大堆 .dll 和其他必须交付的东西。
-
然后列出它们。我不认为
*像您认为的那样工作,如果确实如此,您可以删除 Client.exe 的单独行。 -
如您所见,两者都进入了临时文件夹,但问题是,InnoSetup 使用的替换器不是我在文件部分中指定的那个。向导要求提供主要可执行文件和其他文件。以为我可以相信它;)
标签: inno-setup