wpf InstallShield:无法提取索引为 0 的图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5652368/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:47:16  来源:igfitidea点击:

InstallShield: cannot extract icon with index 0

wpfvisual-studioinstallshield

提问by epalm

I can't seem to figure out why this error is occurring when I build my setup.exe installation file.

当我构建 setup.exe 安装文件时,我似乎无法弄清楚为什么会发生此错误。

Error 5 -3204: Cannot extract icon with index 0 from file C:\dev\MyProj4\MyProjClientWpf\obj\x86\Release\MyProjClient.exe. ISEXP : error : -3204: Cannot extract icon with index 0 from file C:\dev\MyProj4\MyProjClientWpf\obj\x86\Release\MyProjClient.exe.

错误 5 -3204:无法从文件 C:\dev\MyProj4\MyProjClientWpf\obj\x86\Release\MyProjClient.exe 中提取索引为 0 的图标。ISEXP:错误:-3204:无法从文件 C:\dev\MyProj4\MyProjClientWpf\obj\x86\Release\MyProjClient.exe 中提取索引为 0 的图标。

In the Shortcuts/Folders section, for the shortcut I'm generating, Icon File is blank, and Icon Index is 0. Whatever default icon is fine, I didn't specify one nor do I even want one.

在快捷方式/文件夹部分,对于我生成的快捷方式,图标文件为空,图标索引为 0。无论默认图标如何,我都没有指定一个,我什至不想要一个。

Any ideas?

有任何想法吗?

采纳答案by Christopher Painter

Windows Installer Advertised Shortcuts require an icon resource. At build time, InstallShield will extract this resource and populate the Icon table. This error is saying that this wasn't possible.

Windows Installer Advertised Shortcuts 需要一个图标资源。在构建时,InstallShield 将提取此资源并填充 Icon 表。这个错误是说这是不可能的。

The simplest solution is to add an icon resource to your project and rebuild the EXE:

最简单的解决方案是在你的项目中添加一个图标资源并重建EXE:

  • Right click your WPF project in Solution Explorer and select Properties in the menu;
  • In the Properties page, select the Application tab (it should be already selected);
  • Go to the Resources section and click on the (...) at the right of the Icon field;
  • Select your desired .ico file and click Open.
  • 在解决方案资源管理器中右键单击您的 WPF 项目,然后在菜单中选择属性;
  • 在 Properties 页面中,选择 Application 选项卡(它应该已经被选中);
  • 转到“资源”部分,然后单击“图标”字段右侧的 (...);
  • 选择所需的 .ico 文件并单击打开。

Alternatively you can set the shortcut to not be Advertised and Windows will resolve a default icon for you when the start menu is displayed. You will lose some of the advertisement capabilities of MSI in doing this so I really suggest that you just provide it with an Icon.

或者,您可以将快捷方式设置为不做广告,Windows 会在显示开始菜单时为您解析默认图标。这样做你会失去 MSI 的一些广告功能,所以我真的建议你只为它提供一个图标。

回答by saviiles

I was getting this problem, I try a lot of solutions on the web, but the only way that works for me:

我遇到了这个问题,我在网上尝试了很多解决方案,但唯一适合我的方法是:

  1. Expand the setup project (Solution Explorer)
  2. Expand the menu "Configure the Target System"
  3. Double click on Shortcuts folder
  4. Here you will find 2 output you set up in the project wizard.
  5. Select one of them, and find the property Icon, click to (...) to browse the propertly icon.
  6. Do the same with the second one output built solution.
  7. Rebuild your project!
  1. 展开安装项目(解决方案资源管理器)
  2. 展开菜单“配置目标系统”
  3. 双击快捷方式文件夹
  4. 您将在此处找到在项目向导中设置的 2 个输出。
  5. 选择其中之一,找到属性图标,点击(...)浏览属性图标。
  6. 对第二个输出构建解决方案执行相同操作。
  7. 重建你的项目!

Regards,

问候,

回答by GORa

This issue occurs if create shortcut is enabled and icon is not set. 1. Goto Project assistant -> Application shortcuts. 2. Download some icon, browse and select it for Use alternate shortcut icon.

如果启用了创建快捷方式但未设置图标,则会出现此问题。1. 转到项目助手 -> 应用程序快捷方式。2. 下载一些图标,浏览并选择它作为使用备用快捷方式图标。

Rebuild.

重建。

回答by Mark Macneil Bikeio

Simple Solution:

简单的解决方案:

At the time of Installation Wizard, while missing the reselection of the Image / Icon for shortcut after we have browsed the resource path. Missing this causes this index error (please refer screenshot). after re-selection rebuild is required this solves problem.

在安装向导的时候,虽然我们浏览了资源路径后错过了重新选择图像/图标作为快捷方式。缺少它会导致此索引错误(请参阅屏幕截图)。在需要重新选择重建后,这解决了问题。

enter image description here

在此处输入图片说明