Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

Desktop shortcuts have no icon

Open Sharpiro opened this issue 9 years ago • 9 comments

Regardless of what combination of command line parameters I use, my desktop shortcuts never have icons, yet the setup.exe always has an icon even if I only specify --icon=Value.

The following cause the setup.exe to have an icon, but not the desktop shortcuts:

  • --setupIcon=".\common\misc\logo.ico" --icon=".\common\misc\logo.ico"
  • --icon=".\common\misc\logo.ico"
  • -i ".\common\misc\logo.ico"

Sharpiro avatar Mar 27 '17 18:03 Sharpiro

Hi, did you ever find out what the problem was? I'm having the same problem.

Petur06 avatar Apr 03 '17 09:04 Petur06

No, it's still an issue for me.

Sharpiro avatar Apr 04 '17 16:04 Sharpiro

In my case, I have more than 5 executables, however I only want two particular shortcuts on desktop.

After I got some strange issues on icon business, I finally decided to use my own method (see below). Basically it fires when update (for that, you have to set <Assembly: AssemblyMetadata("SquirrelAwareVersion", "1")> in the AssemblyInfo), and it makes my desktop icons are correct.

Well, I suppose it is only problem when many executables... When 1 or 2 executables, Squirrel works fine. Other than the icon biz, I am quite happy with Squirrel.

Imports IWshRuntimeLibrary Module Module1

Sub Main()
    Dim CurrentAssembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
    Dim StrCurrentAssembly As String = CurrentAssembly.GetName().Version.ToString(3)
    Dim VersionNumber As String = "app-" & StrCurrentAssembly
    Dim FolderPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Program1\" & VersionNumber
    Dim FilePath As String = FolderPath & "\Program1.exe"
    Dim ShortcutFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    Dim ShortcutText As String = "Program1e"
    Dim Description As String = "Shortcut for Program1"
    CreateShortcut(FolderPath, FilePath, ShortcutFolder, ShortcutText, Description)
    'YFLicMgr.exe
    FilePath = FolderPath & "\Program2.exe"
    ShortcutFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    ShortcutText = "Program2"
    Description = "Shortcut for Program2"
    CreateShortcut(FolderPath, FilePath, ShortcutFolder, ShortcutText, Description)
End Sub

Public Sub CreateShortcut(ByVal FolderPath As String, ByVal FilePath As String, ByVal ShortcutFolder As String, ByVal ShortcutText As String, ByVal Description As String)
    Try
        Dim myShortcut As IWshShortcut
        Dim wsh As New WshShell

        myShortcut = CType(wsh.CreateShortcut(ShortcutFolder & "\" & ShortcutText & ".lnk"), IWshShortcut)
        With myShortcut
            .TargetPath = FilePath
            .WorkingDirectory = FolderPath
            .WindowStyle = 1
            .Description = Description
            .IconLocation = FilePath & ", 0"
            .Save()
        End With
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

End Module

chromworks avatar Apr 04 '17 16:04 chromworks

I have same issue. Icon only appears when it's in the compiled EXE, and there's no way to override it on the shortcut.

Edit: using http://www.angusj.com/resourcehacker/ to replace icon before running Squirrel. Not ideal, but works for now.

ivoloshin avatar Apr 05 '17 15:04 ivoloshin

Try not using quotes in the path, so the first post's command would use:

--setupIcon=.\common\misc\logo.ico --icon=.\common\misc\logo.ico

I think that's what I did and it worked then. Of course that means your path can't contain any spaces. If someone else can confirm that's it we may want to look into a fix for this 😄

bddckr avatar Apr 05 '18 10:04 bddckr

Found it, just had to set the icon on application properties in visual studio.

gps-dev avatar Apr 05 '18 10:04 gps-dev

I have the same issue. When i click on the shortcut on the desktop the path in the "start in" path looks weird. I have tried downloading it. In my first try i thought it was because i used a big I in the name --Icon but no it still does not work. This is really unfortunate since it is stalling my whole release. And i might have to start looking for another install tool.

christiandersen avatar Sep 16 '18 13:09 christiandersen

--icon has nothing to do with the shortcut icon. Please read the documentation, especially the part around Squirrel Events.

anaisbetts avatar Sep 16 '18 16:09 anaisbetts

I am getting to the end of creating a new installation package for my Image Measurements tool. I thought it would be cool to use Squirel. Because it said better than click once. Now i created an installation exe package and it installs but the desktop and startmenu link files are not working properly. The destination folder is pointing to at exe file which is one step higher than the app one. Which is totally wrong. And the start in directory simply just looks malformed.

Destination: C:\Users\ChristianAndersenAve\AppData\Local\ImageMeasurementApp\ImageMeasurement.exe

Start in: istianAndersenAve\AppData\Local\ImageMeasurementApp\app-18.10.6TC:\Users\ChristianAndersenAve\AppData\Local\ImageM

And as a topping on the cake the application shortcuts do not have an icon.

Any ideas?

I also tried doing this in code, by activating: //[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] but it's the same thing.

christiandersen avatar Oct 13 '18 23:10 christiandersen