Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InnoSetup - Erroneous "File in use by another process..." message while compiling

Although I really like InnoSetup, I have been suffering with this erroneous message for some time, but my frustration has reached new heights. There are numerous posts complaining about this problem, which is most certainly an InnoSetup bug, but no useful work-arounds that I can find.

I have a very simple (signed) setup that merely copies some files and creates a shortcut. It does not even include an executable. When I try to compile the setup, I am getting this "the process cannot access the file because it is being used by another process" message - repeatedly (normally I always get the setup to compile within 3 tries), but now it seems futile after many. many tries. The file that is "in-use" is not clear from the InnoSetup output or error dialog. There are most definitely no competing processes running. (I have rebooted the machine and still get this message).

Any ideas on how to resolve this are much appreciated.

Here is the complete setup code - it is signed, but that is not a problem with other setups I have created with the same signature.

#define MyAppName "Easy-IAP for IronKey"
#define MyAppVersion "4.0"
#define MyAppPublisher "Command Post Solutions"
#define MyAppURL "http://www.commandpostsolutions.com/"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{51668D56-27F6-4C83-87F2-677328EFE808}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName="\EZ-IAP"
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=IronKeySetup
SetupIconFile=C:\Users\ron\Dropbox\EZIAP\eziap.ico
Compression=lzma
SolidCompression=yes
SignedUninstaller=yes
SignTool=Standard /d $qEasy-IAP Installer$q $f                                                                   

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

[Files]
Source: "C:\Users\ron\Dropbox\Easy-IAP for IronKey\AccessDatabaseEngine.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist
Source: "C:\Users\ron\Dropbox\Easy-IAP for IronKey\dotNetFx40_Full_x86_x64.exe"; DestDir: "{app}"; Flags: onlyifdoesntexist
Source: "C:\Users\ron\Dropbox\Easy-IAP for IronKey\Easy-IAP for IronKey\bin\Release\Easy-IAP for IronKey.exe"; DestDir: "{app}";
; NOTE: Don't use "Flags: ignoreversion" on any shared system les
[ICONS]
Name: "{drive:{app}}\Easy-IAP"; Filename: "{app}\Easy-IAP for IronKey.exe"; 
like image 586
ron tornambe Avatar asked Mar 13 '13 22:03

ron tornambe


3 Answers

I had the same problem. It was due to McAfee antivirus running the realtime scanning on the exe file being compiled... As it doesn't seem possible to exclude a directory from realtime scanning, I shut it down in McAfee SecurityCenter, and now it's good. Hope this help

like image 71
Bonrry Avatar answered Nov 20 '22 15:11

Bonrry


The problem is often an explorer window being open viewing the folder where the output files will reside.

Explorer continually opens the executable as it is built trying to fetch its icon and other metadata. Close any open explorer windows which are viewing the output folder and try again.

For this reason you are best running your inno setup file from the command line or part of a visual studio or other automated build process.

like image 14
braindigitalis Avatar answered Nov 20 '22 17:11

braindigitalis


This is not a bug, this is only bad design of application (or bad documentation) :)

Use the OutputDir directive in your [Setup] section to avoid this wrong behaviour.

OutputDir=c:\output

OutputDir specifies the "output" directory for the script, which is where the Setup Compiler will place the resulting SETUP.* files. By default, it creates a directory named Output under the directory containing the script for this.

You ask why?

If you do not use OutputDir in your script file (and many people do not use it) Inno Setup tries to create resulting setup in the "userdocs:" folder which causes a lot of troubles on all Windows systems.

Always use this parameter, even if you want to have resulting setup in current folder, in that case use:

OutputDir=output
like image 6
Slappy Avatar answered Nov 20 '22 16:11

Slappy