Visual Studio Installer Project - shortcut icons not set

10,098

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
10,098
Admin
Author by

Admin

Updated on July 02, 2022

Comments

  • Admin
    Admin almost 2 years

    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!

  • Admin
    Admin over 5 years
    I have found out it was exactly the same issue in my case too! Just adjusting the ICO file to a standard resolution (I used 48x48 IIRC) fixed the issue! So, as long as I'm concerned, I'm marking this as the correct answer.
  • Roocha Thakker
    Roocha Thakker over 4 years
    Heyy, I was not intending to duplicate the answer above I was describing how I solved my problem as if you visit the website above the have a various format and i had got confused, so I used all of them, to avoid someone making the mistake that i made. I am sorry if it seems as a duplicate.
  • Roocha Thakker
    Roocha Thakker over 4 years
    I was using this to understand icons in windows: docs.microsoft.com/en-us/windows/win32/uxguide/vis-icons
  • Nilesh Barai
    Nilesh Barai almost 4 years
    i had similar issue, found that my ico file was 256x256. Converted it to 64x64 and it worked.
  • Sujoy
    Sujoy over 2 years
    Dude you did not mention the size.