Setting correct icon for Shortcut in VS2010 Setup Project

前端 未结 4 1130
渐次进展
渐次进展 2020-12-11 01:18

I have a small app with a setup project. If I create a shortcut to my Primary Output, then this gets a standard Win7 icon and not the icon specified in my exe\'s Application

相关标签:
4条回答
  • 2020-12-11 01:44

    If you set the icon for the shortcut you can set a primary output as source. In the file system editor of the setup project, click on the "(Icon)" combobox in the properties pane of the shortcut, then option "(Browse...)", button "Browse...". You'll see this:

    Add Output

    Then add output and select the primary output of the exe.

    0 讨论(0)
  • 2020-12-11 01:45

    To add to Gert's answer: make sure you build your project first. Otherwise the setup app will not see the icon.

    0 讨论(0)
  • 2020-12-11 01:55

    You can add an icon from your target.exe file to the shortcut... in File System On Target Machine, browse to the shortcut in the folder you want to add the icon to (User's Desktop,etc). Right click the shortcut and select Properties Window. You'll see an Icon line... click it, select Browse, then browse to Application Folder/yourExe.exe (change from ICON to Exe files) and say OK. It will show you the icon from yourExe.exe that it has selected, say OK. You basically have to do the same thing for your Add/Remove Icon (appears in Control Panel/Uninstall)... properties page for your setup project. You have to do it for all shortcuts in different folders (User's Desktop, User's Startup, etc.) All icons good now!

    0 讨论(0)
  • 2020-12-11 01:57

    Very simple way using IWshShortcut (works in .net 2 too):

    WshRuntimeLibrary.IWshShortcut MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(fullPathLnk);    
    string iconLoc = MyShortcut.IconLocation; // <- example: "c:\icon.ico,0"
    

    I use to check if iconLoc still exists, fix if not, you can use to find and read icon file, etc etc

    0 讨论(0)
提交回复
热议问题