简体   繁体   中英

Inno Setup error on SetupIconFile - The process cannot access the file because it is being used by other process

For some reason I'm getting the error below when setting up the Setup Icon for the installer.

ERROR:

The process cannot access the file because it is being used by other process

Script:

#define MyAppName "MyApp 4.0"
#define MyAppVersion "4.0"
#define MyAppPublisher "Some Company Name"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyApp.exe"

[Setup]
AppId={{F89D3454-5DFD-471B-B4A1-D49DFB8637B0}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\MyApp App
DisableDirPage=yes
DisableProgramGroupPage=yes
LicenseFile=C:\Users\Some Folder\MyApp-License.txt
OutputDir=C:\Users\Some Folder\Installers
OutputBaseFilename=Setup-MyApp
SetupIconFile=C:\Users\Some Folder\Logos\logo.ico
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.Extras.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.Extras.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.Platform.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.Platform.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\GalaSoft.MvvmLight.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Microsoft.Practices.ServiceLocation.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Microsoft.Practices.ServiceLocation.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Newtonsoft.Json.xml"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.AvalonDock.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.AvalonDock.Themes.Aero.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.AvalonDock.Themes.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.AvalonDock.Themes.VS2010.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.DataGrid.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\UserName\SomeFolder\MyApp\bin\Release\Xceed.Wpf.MyAppkit.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

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

If I comment out line SetupIconFile=C:\Users\Some Folder\Logos\logo-name.ico it compiles fine without errors.

Any idea what can I do to be able to fix this issue?

Thanks

An .ico file consists of more than one lay-out (or grid) of a given picture. Like 24 24 pixels, 48 48 pixels 64 64 pixels etc depending on what screen resolution being used. Maybe one of the needed layers is absent or the entire .ico file is indeed locked. Try Ico-FX to create an *.ico file of a BMP and use it in your script. or extract an icon via an icon-extractor.

Whatever you do, use a short path, preferable with no spaces to begin with.

Inno Setup Docs suggest (at least) the following sizes:

16x16 32x32 48x48 64x64 and 256x256

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM