SetupIconFile上的Inno Setup错误-该进程无法访问该文件,因为其他进程正在使用该文件

时间:2019-01-02 13:29:54

标签: c# wpf inno-setup

出于某种原因,在为安装程序设置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行中注释掉,则可以正常编译而不会出错。

您知道该怎么做才能解决此问题?

谢谢

1 个答案:

答案 0 :(得分:-1)

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

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