Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 490
F.Pol Avatar asked Sep 29 '18 10:09

F.Pol


2 Answers

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

like image 55
Cris Maule Avatar answered Sep 24 '22 16:09

Cris Maule


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.

like image 22
Damiano Avatar answered Sep 24 '22 16:09

Damiano