简体   繁体   中英

How to set icon for the desktop shortcut of setup project created using visual studio Installer?

I have created a Setup Project from Visual Studio Installer .
I installed the MSI and I was able to install the application. I want to add an icon for the shortcut I have created on the desktop. For this I tried the following steps:

  • 1) Selected the desktop shortcut from the FileSystem view.
  • 2) Press F4 for properties.
  • 3) For the Icon Field selected Browse option.
  • 4) Clicked on Browse button.
  • 5) Set File of type to Executable(.exe)
  • 6) Press OK and OK again.
  • 7) Then build my C# application and then the Setup Project.
  • 8) Then ran the MSI from the debug location.
  • 9) Then a shortcut created and as well as.exe file got installed on the desktop.
  • 10) ICON size is 16*16 .

The .exe file shows the ICON , where as the desktop shortcut for the same executable is not showing ICON and it showing as below.
在此处输入图像描述

I can not figure out why it does not show the icon.

Could someone please help me to resolve this issue?

Finally I resolved it. The solution for this is changing the ICON size from 16*16 to 48*48 pixel. I have set my application ICON size to 48*48 pixels and the same is selected while setting the ICON for the desktop shortcut in the setup project. Even ICON of size 24*24 also worked. Hope this helps someone looking for similar issue.

I've had a similar problem and i solved it when i included the *.ico file directly in the Installer Project.

First you have to include the *.ico file for your shortcut, rightclick on your installer project in solution explorer and "Add", then "File", then choose your icon. ( Settings.ico for example )

项目设置

Then you should choose your icon file for the shortcut and click ok. ( your step 5 and 6 )

选择图标

After installation, your icon should shown correct on the desktop.

Be aware that with this solution, the icon file is copied to your application folder after installation, but nobody should disturb that.

EDIT:

You should see your selected icon when you click on the right menu "(Icon)" => "(Browse...)":

显示图标

Here the settings for the shortcut:

设置

Check your settings if they fit.

In MSVS->Setup go to "User's Programs Menu->Shortcut->Properties->Icon" select your Icon and rebuild. This fixed it for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM