InstallShield: cannot extract icon with index 0 (for dummies) - c#

Yes I did my homework first. And I'm still stuck. First let me express my irritation at Microsoft for deprecating the Installer project type. Shame on them.
Back to my issue, Here is the error:
Error 3 -3204: Cannot extract icon with index 0 from file <some_path>\obj\Debug\MyProject.Gui.exe.
Attempt #1: InstallShield: cannot extract icon with index 0 vb.net
-- The answer says to include an object of type icon in my exe and rebuild. To do this, I tried the following:
right clicked on my windows forms project, add new item, icon, save all
open the icon file in step 1, draw some text in it, save all
right click the project and select rebuild (no errors, looks good)
left click on 'Specify Application Data'->'Files', select the *.ico in the project (Note: I can see it clearly listed, and it appears in the dialog as index0)
left click on 'General Information'-> 'Display Icon' -> browse for the *.ico (located in project folder for MyProject.Gui.exe)
save all and rebuild all
...I still get the same error message.
How does one "Recompile your EXE to include an icon and the message will go away"?

I had the same issue. Your problem is because you need to embed the icon into your executable. The way you do this is in Project Properties window in Visual Studio (Alt-Enter or right click ->properties for project root in solution explorer).
In the project properties under Application, there's a group box called Resources. Add your icon as shown below and install shield will build fine.
Hope that helps.

I was getting this problem, I try a lot of solutions on the web, but the only way that works for me:
Expand the deploy solution (+) on the right panel (Solution Explorer)
Expand the menu "Configure the target system"
Double click on Shortcuts folder
Here you will find 2 output you set up in the project wizard.
Select one of them, and find the property Icon, click to (...) to browse the propertly icon.
Do the same with the second one output built solution.
Rebuild your project!
Regards,

You need to copy the icon file to the debug folder of your windows application to successfully compile.

Go to Shortcuts/Folders under configure the Target System.
Select your application from the tree.
Select the icon and change the index to 2 (or something other than 0)
Build it.

If the problem is that you associated the icon with the installer and you embedded it into your application but you are still getting this error, try adding a folder exception to your antivirus software. The exception should be the folder where your source is located and the executable is output.
The symptom is that you randomly get this error during a build. It is caused by your antivirus software preventing the installshield icon extractor from accessing your application executable.

This happened with me also. My application runs in the background so I didn't create an Icon for it. When this error occurred I assigned an icon and everything built okay.

Related

Visual Studio Installer Project - shortcut icons not set

I've created a WinForm application with .NET 4.6.1 and C#. I'm using Visual Studio 2017, with latest fixes updated (up to 29-Sept-2018).
The application uses a custom icon, and it's correctly shown: exe file is displayed with the proper icon.
I've created an Installer Project using the "Microsoft Visual Studio 2017 Installer Projects" extension. The installer copies sets of files in different locations (under Program Files, under the user's App Data, etc), and the files are correctly copied. EXE files correctly display the custom icon I've set.
Now, here comes the problem.
I've set a shortcut on the desktop.
The shortcut is created and actually works, but the icon is wrong: the default windows icon is shown instead.
I've tried several solutions and read from several forums.
1- I've tried to "Create New Shortcut" from the File System view (Desktop folder), and then set the Icon from the Properties window.
2- I've tried to right-click the output exe and select "Create a shortcut to primary output", and then dragged the shortcut to the desktop folder.
3- I've tried to select the icon referencing directly the Application Output exe: the wizard allows me to select the correct icon, I select it and confirm.
4- I've tried to select the icon referencing the source ICO file: once again, the wizard allows me to select the correct icon, I select it and confirm.
Any solution I've tried, I ALWAYS obtain a shortcut displayed with the default icon and NOT with the custom icon.
Whatsmore, if I try to manually "Create a shortcut" by right-clicking on the EXE, in window's File Explorer, the shortcut is created using the correct custom icon! So, it's strange that Visual Studio (or the installer) is not able to do the same thing during the installation.
Do you have any idea of the cause of the problem, and how to fix it?
Thanks!
I had the same issue, and tried every combination the OP also tried.
In the end my issue was down to the fact my .ICO file did not have the correctly sized images for the desktop shortcut. (It would have been nice if Visual Studio had told me that!!!!)
Oddly like the OP generating a shortcut by hand did make the icon appear, so I find the above a bit strange!
Anyway I was generating my .ICO file using GIMP to convert a PNG. I had clearly got this stage wrong.
I'd suggest trying a different .ICO file first and see if that is the cause.
It was for me and I solved it by using the following site:
http://icoconvert.com/
I then ticked the relevant boxes for the sizes, used this new .ICO file and hey presto it all works
I'd the same problem.
I had fix it simply select the main ouput (.exe) and not the .ico in the shortcut property icon option. I suppose installer not recognize the .ico file correctly.
I encountered the same problem. Just ensure you set the icon for the project to the same icon file as for the desktop shortcut and user program shortcut.
The icon file must follow the dimensions of Windows 7.
You can use http://icoconvert.com/ for changing the icon dimensions.
I had the same problem, using VS 2019 with the Visual Studio Installer extension.
I checked my icon had the correct dimensions (16x16, 32x32 and 48x48 within the ICO file), so it wasn't this.
Also, I had previously installed the app and the icon had worked fine. I'm using the "replace previous version", but I'm not sure if this is cause.
I double-checked the installers Outputs, and yes, the .ico was being copied/included... however I found that the defined shortcut (in VSI editor) did not have the icon property defined anymore - it had reverted to "(None)".
1
I resolved it in VSI, by using the Properties window for the shortcut, on the Icon property, select Browse from the DDL, then set the .ico from the source file. (The VSI detail tab still shows the default "text doc" icon, but result after install is the one I wanted/selected).
This is not the first time VSI has done this to my projects, so I'm guessing it is a slight bug of this otherwise great extension.
The problem for me was that the .ico was compressed with PNG.
Do not export using Vista PNG compression! Use normal BMP frames instead.

How To Fix Icon For InstallShield

I used to be able to create a setup project in Visual Studio, but now Microsoft has "improved" it and I'm wasting hours trying to get a simple project to someone else in my company. They need to upgrade their version of .NET or I wouldn't even use a setup. So after going through the pain of downloading their "improved" InstallShield and going through the pain of watching a video and setting all the parameters I tried to build the Setup project and it says the icon isn't valid. "Screw the icon. Let me deploy my project." The actual error message is "Cannot extract icon with index 0 from file ..." It doesn't matter to me if this uses a standard icon or no icon, I just want the user to be able to test this project.
So, what is the easiest way to get this setup project in the hands of my user?
I solved this problem by adding a new icon to the project and re-compiling. You can do this by right-clicking on the project and selecting Add -> New Item -> Icon File. Then assign that icon file under the Project -> Properties menu item.
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.
Simple way to fix this error :
Right click on your project- go to properties-application tab-in application tab set icon to your project in Icon & Manifest option

Error -3204:Cannot extract icon with index 0 from file

In building an installer for my application,i repeatedly getting an error:
Error -3204: Cannot extract icon with index 0 from file C:\Users\....
A quick google search got me here (where the issue isn't resolved) and following step by step procedure here enabled me to add C:\Windows\system32\shell32.dll everytime i build my project, then selecting icon:2 .A setup.exe is created despite an error
and installs app for me but with no trace in Add/Remove programs in Control Panel.
How to get that icon in Add/Remove Add/Remove programs in Control Panel.
EDIT: if there's any other software for windows installer for VS2013 such as SetupProject with the previous releases of VS 2xxx please suggest me
You should change the method of creating the setup file. See the link below :
Clike Here
Update :
Here are two other setup applications which can make setup of your application.
QSetup
and Centurion Setup
You can try them to make setup for your application.
<ISProductFolder>\redist\Language Independent\OS Independent\setupicon.ico
When I used the file path above in the project assistant --> application shortcuts section --> use alternate shortcut icon, the basic icon showed up and allowed me to select the icon. Now my project builds without this error. (the icon looks bad but it works.....)
IconShow

Unable to access 'Build Action' property for .cs files

i got a problem with my site with my app_code files and a lot of question ive read people say you need to change the proprties of the .cs files to Build Action.
by right clicking the .cs files and press proprties.
but...
when i right clicking the files i cant see any option called proprties so i press F4 and it open a proprties window and i just click on the .cs file and still cant see any option i can change somthing to Build Action.
any idea why i cant see this options?
EDIT:
my problem is that when i get in the file proprties i have only 2 options...
thay are called:
1.Full Name
2.Full Path
EDIT2:
here what i see in visual studio 2010 when i try access the protrtie menu/window
http://img338.imageshack.us/img338/2359/blac.png
As Microsoft points out in the article "Web Application Projects versus Web Site Projects":
Web application projects use Visual Studio project files (.csproj or
.vbproj) to keep track of information about the project. Among other
tasks, this makes it possible to specify which files are included in
or excluded from the project, and therefore which files are compiled
during a build.
An answer to a similiar question at CodeProject's forums reveals a hint. Abstract:
[...] Looks like you are working on a web application that is actually a
Website as per Visual Studio. You would need to create a new Web Application
and probably copy over the source files there. [...]
http://www.codeproject.com/Questions/173637/Setting-Build-Action-for-Files-in-App_Data
Have you tried this:
You say you haven't got the option being suggested by other posters.
If this is the case, than it is quite possible that your Visual Studio settings are corrupt; this can give rise to all sorts of odd behaviour.
I would suggest you reset your settings, but please be aware you will lose any custom IDE settings that you've previously applied.
Try this:
In Visual Studio, go to Tools->Import and Export Settings
Choose "Reset All Settings" and click Next
Choose to save your current settings if you wish, or select "no" and then click next.
Choose the collection of settings( he IDE preset) you want, probably "Visual C# Development Settings"
Visual Studio will now revert all settings. Hopefully this will make the Build Action reappear.
[EDIT]
It might be worth trying safe mode too.
To do this, start up a "Visual Studio Command Prompt" from your start menu/programs list in Windows, and start Visual Studio with
devenv.exe /SafeMode
Does this make the options appear?
You can copy the file from Windows Explorer and paste it in the Solution Explorer. It will replace (or do nothing but incorporating it in the proj file) the file and recognize it as C#.
Normally you should see a Property named "Build Action" in the first line of the Property Window. This property should be set to "Compile".
Please select file and right click on it so that you will get following screen
Than click on the Properties you will get following screen
You can find build option in as a first option.

Application Icon doesn't change correctly using c#

I changed my Application's icon for a new one, by going to: "Project/MyProject Properties/Icon and Manifiest", and load the new icon. Now, in my debug folder the icon of my .exe file appear with the new icon, which is ok, but when I execute the .exe, the application icon in the taskbar still showing the old one.
Please advice.
You have two place to change your icon.
First place
The first place is in the project.
Right click on the project
Select Property
Go in Application Tabs
Choose Icon and Manifest and select the icon you want
Second place
The second place is in the property of your Winform.
Open the Form
Click on the Form
Press F4 or go in the property of the Form
Go down in the property to find "Icon"
Select the icon you want.
The reason you have a different icon in the taskbar than your application (.exe) icon is that the taskbar use the current form icon to display in the taskbar.
After encountering the same problem, I resolved it by doing the following:
Just stop your explorer.exe from task manager and rerun the explorer.exe again.
As a commenter mentioned, you should set in the properties of the *.ico file: Copy to Output Dir: Copy if newer.
This property is not absolutely required. I developed a winform application and tested it without icon. Then I created and added the icon. The icon showed when running with the VS debugger. I copied the bin/debug directory to another pc and there it ran with showing the icon.
But the icon did not show on the development machine when the app started by clicking the *.exe file.
Logout/login windows did not cure this.
Change the Copy To Output Dir property on the icon file to Copy If Newer, and rebuild the application, did help. Now I can start the app by clicking the *.exe and the icon shows nicely.
Conclusion:
It is not always required to build the app with the icon file copied to the output directory, but with this measure you will increase your chances.
Make sure that your *.ico file contains an icon of the proper size (like 16x16 for small task bars).
Copy your new icon in Project Properties --> resources --> icons
In your Main_Load function add:
this.Icon = Properties.Resources.newIcon;
Check this out for icon information and sizes it supports. Assuming this is just a simple error that you are getting check if your ico's are as per what is specified here http://msdn.microsoft.com/en-us/library/ms997636.aspx
I had the same problem and none of the above solved it.
In my case, I had defined the icon different for two different langages (default language english and german). You can see this if there appear two resources files: FormX.resx and FormX.de.resx
With the accepted answer only default icon was changed. But when running the application on my pc the german icon was used.
So I had to change the icon for both resources. In Visual Studio you can change the current resource language by switching the language item (in the forms properties) from default to another language.
I had the same problem. The "first place" mentioned by Patrick is about the file icon, i.e. the .exe aspect. The "second place" is about the form (in the upper left corner).
Restarting windows file explorer seemed to be a satisfactory solution too. But all this didn't work today. I didn't restart the computer, by the way.
This is what really displayed the new icon in the task bar: I realized that there was an old shortcut of the .exe on the desktop. Deleting the shortcut did the job.

Categories

Resources