【问题标题】:Inno Setup error on SetupIconFile - The process cannot access the file because it is being used by other processSetupIconFile 上的 Inno Setup 错误 - 该进程无法访问该文件,因为它正被其他进程使用
【发布时间】:2019-01-02 13:29:54
【问题描述】:

由于某种原因,在为安装程序设置 Setup Icon 时出现以下错误。

错误:

该进程无法访问该文件,因为它正在被其他进程使用

脚本:

#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

如果我注释掉SetupIconFile=C:\Users\Some Folder\Logos\logo-name.ico 行,它编译得很好,没有错误。

知道我可以做些什么来解决这个问题吗?

谢谢

【问题讨论】:

  • 是脚本中的错字还是安装图标与其他文件位于不同的目录中(C:\Users\Some Folder\Logos\logo.ico vs C:\Users\UserName \一些文件夹)?如果将 ICO 文件移动到不同的目录会发生什么?它仍然失败吗?
  • @mirtheil 我尝试将它移动到Desktopbin\Release 文件夹,但我得到了同样的错误。
  • 如果您使用不同的图标,您会收到错误消息吗?也许 InnoSetup 中包含的示例:SetupIconFile=C:\Program Files (x86)\Inno Setup 5\Examples\setup.ico
  • Program Files 中的Examples 文件夹不包含.ico 文件,实际上我在任何地方都找不到。我确实创建了一个不同的 .ico 文件并尝试了它,但我得到了同样的错误。谢谢。
  • 我的错,我之前一定是复制了一份。如果您尝试了多个图标,您可能会查看 LockHunter (lockhunter.com) 之类的工具来查看锁定该文件的原因。您可能还想重新启动机器。我正在用各种图标编译没有任何问题。

标签: c# wpf inno-setup


【解决方案1】:

*.ico 文件包含给定图片的多个布局(或网格)。 如 24*24 像素、48*48 像素、64*64 像素等,具体取决于所使用的屏幕分辨率。 可能需要的层之一不存在或确实被锁定。 尝试使用 Ico-FX 创建 BMP 的 *.ico 文件并在您的脚本中使用它。 或通过图标提取器提取图标。

无论你做什么,使用一条短路径,最好不要以空格开头

【讨论】:

  • 您不能锁定文件的部分。错误消息显然是指整个文件,而不仅仅是文件的某些组件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-08-18
  • 1970-01-01
  • 1970-01-01
  • 2010-12-10
相关资源
最近更新 更多