none
Missing Icon in Add/Remove Programs for ClickOnce Application

    Question

  • I am currently working on a ClickOnce application, and I noticed that a default icon is used instead of the actual application icon in the Add/Remove programs list.  The icon displays correctly in the start menu.

    Is this a known limitation of ClickOnce applications, or can it be fixed?

    Thursday, July 20, 2006 6:02 PM

Answers

  • If they retire some part of Visual Studio, they will replace it with something else. (Are 'Installer' projects the same as Setup & Deployment projects?)

    By the way, here's some code you can run to update the icon in add/remove programs. We run this when the application starts up, and we use the same icon that our application displays.

    /// <summary>
    /// set the icon in add/remove programs for all GoldMail products (because this code is only in Akamai for now)
    /// </summary>
    private static void SetAddRemoveProgramsIcon()
    {
      //only run if deployed 
      if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed
         && ApplicationDeployment.CurrentDeployment.IsFirstRun)
      {
        try
        {
          string iconSourcePath = Path.Combine(System.Windows.Forms.Application.StartupPath, "GM_GoldBlueG_multi.ico");
          if (!File.Exists(iconSourcePath))
            return;
    
          RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");
          string[] mySubKeyNames = myUninstallKey.GetSubKeyNames();
          for (int i = 0; i < mySubKeyNames.Length; i++)
          {
            RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true);
            object myValue = myKey.GetValue("DisplayName");
            if (myValue != null && myValue.ToString() == "GoldMailAkamai")
            {
              myKey.SetValue("DisplayIcon", iconSourcePath);
              break;
            }
          }
        }
        catch (Exception ex) {}
      }
    }
    
    

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Izor Wednesday, August 25, 2010 7:24 PM
    • Marked as answer by RobinDotNetMVP, Moderator Wednesday, September 01, 2010 2:45 AM
    Wednesday, August 25, 2010 6:44 PM

All replies

  • I also have the same problem.  An answer would be great!!
    Thursday, July 20, 2006 8:57 PM
  • It is by design that default icon is shown in Add/Remove Programs eventhough you have custom icon in Start Menu. Are there any reasons that you must have custom icons in Add/Remove Programs?
    Thursday, July 20, 2006 9:24 PM
  • Pretty much every other application in Add/Remove programs has a custom icon, so a ClickOnce application that doesn't have the appropriate icon is more difficult to locate in the list and looks unprofessional, as well as not following what seems to be the accepted standard.

    If this is by design then I guess I can't do anything about it, thanks for the insight.

    Thursday, July 20, 2006 9:40 PM
  • Was there an answer on this?

    I too would like to have a custom icon appear in the add remove programs while using click once.

    I don see where there was an answer regarding how to do this. These only seem to be a questions as to why one would want to do it.

    Can it be done? I definitely would like to provide a custom icon in the add remove programs window. It helps with application identification, and it also looks more professional.

     

    Monday, October 09, 2006 3:37 PM
  • Unfortunately it cannot be done in current version of ClickOnce.
    Monday, October 09, 2006 8:10 PM
  • I was able to come up with a solution, but it involves editing the registry.  Below is some sample code:

    RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");

        string[] mySubKeyNames = myUninstallKey.GetSubKeyNames();

        for (int i = 0; i < mySubKeyNames.Length; i++)
        {
         RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNamesIdea, true);

         object myValue = myKey.GetValue("DisplayName");

         if (myValue != null && (string)myValue == _ApplicationName)
         {
          myKey.SetValue("DisplayIcon", _ExecutablePath + @"\App.ico");

          break;
         }
        }

    Basically I loop through the available applications that can be uninstalled on the computer, and set the DisplayIcon value of my application to the location on disk of the appropriate icon file.  This code gets executed the first time the application gets launched.

    Monday, October 09, 2006 9:35 PM
  • Has anyone come up with a solution to this that doesn't involve manually configuring the registry?  The problem with that is that it requires elevated permissions to the registry (beyond what a Standard User has permission to).

    Surely it isn't unreasonable to expect the application icon to be used for its listing in Add/Remove programs... 

    Friday, May 30, 2008 6:43 PM
  • for some reason I cannot find any answer to this issue whatsoever, I have created my own thread here somewhere and also got no helpful response.

     

    heres my scenario;

     

    I need find out how the clickonce runtime determines what the add\remove entries should be for an installed clickonce app.

     

    My issue is that some of the apps we deploy show the custom icon and size and some just show the default icon and nothing else, I have probably spent 6 hours or more just trying to figure this out lol.

    We use .Net 2.0

     

    I have delved into the registry settings and ran regmon and compared the manifest files between 1 app that has all the entries and 1 that doesn’t. I have googled dfshim.dll and dfsvc.exe and getting nowhere, experts exchange seems to have an article on this but I don’t have an account, yet lol.

     

    Wednesday, July 02, 2008 7:06 PM
  • ^^^^^^^^

    any answers to this for petes sake?  lol

     

    Icon for clickonce app in add remove is the default icon even though its specifies an icon file in the .exe.manifest

     

     

     

    Tuesday, July 22, 2008 2:14 PM
  • Two years on and still this thread is open with no definitive guidance. An earlier post put the position clearly: most apps. in add/remove programs have branded icons that correspond to the start menu entry so why doesn't clickonce just use the app. icon?

     

    Providing this would not seem to violate the ClickOnce holy grail of a light footprint so what is the problem ? The issue continues in VS2008.

     

    If this is "by design" please could we have that confirmed,preferrably with some justification. That way we can avoid wasting time before posting new builds looking for a solution/workaround.

     

    Mind you, on reflection, I'm still using ClickOnce two years on and my customers seem to be coming round to it so take this as half-a-rant !

     

     

     

    Sunday, November 16, 2008 9:55 PM
  • It's now 2009 and we're using .Net 3.5 SP1 and its updates to ClickOnce. However, I'm still unable to find out how or why the icon my manifest specifies is not being used in the "Programs and Features"or "Add/Remove Programs" window.

    I 'think' that 6 months ago, it was working. I can't guarantee that it was, as I have no evidence, but from memory, I think we had our application's icon sitting in our "Programs and Features" window. But now its gone. And not only that, the icon being used instead is a Blank Document icon. This is even stranger, as at least I should think that a ClickOnce default icon is used. Other users have reported that their icon is working but using an incorrect icon, one from another one of our products. This is also very strange.

    Is there any new reasons that .Net 3.5 SP1 would have messed around with our icons? Why do we get a Blank Page icon now, instead of the generic ClickOnce icon. And what would make our ClickOnce installation confuse its icon with other products? Perhaps a certificate reason?

    It would be good to know where we stand with icons in the Windows Add/Remove window now that we're in .Net 3.5 SP1.

    Thanks,
    Andre

    A
    Tuesday, February 24, 2009 11:36 PM
  • This may help explain:
    http://blogs.msdn.com/oldnewthing/archive/2004/07/09/178342.aspx 

    Basically, if there is no explicit icon in ARP, Windows guesses.
    Phil Wilson
    Wednesday, February 25, 2009 11:07 PM
  • I'd like to know about official solution as well.
    Thursday, May 13, 2010 10:54 PM
  • Hi

    There is no official solution.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Friday, May 14, 2010 5:22 PM
  • This may help explain:
    http://blogs.msdn.com/oldnewthing/archive/2004/07/09/178342.aspx 

    Basically, if there is no explicit icon in ARP, Windows guesses.
    Phil Wilson


    In the blog posted above there is no information on where Windows (Windows 7 in my case) gets the icon information.

    I have a clean installation and for some reason a lot of programs show a standard icon in the "add/remove programs wizard".

    If the above algorhitm is also used to determine icon locations this would explain, but i was wondering if anyone could point me into the right direction as to where these icon settings are stored?

    [Edit]

    Ah, i noticed there is also a 'DisplayIcon' value which does not seem to have been created for various applications.

    Sunday, July 11, 2010 8:35 AM
  • To keep the thread alive: Why is there still no solution for this and is it coming in the future and when? I mean saying there is no official solution without any further explanation doesn't really help anyone who just wants to develop a nice app..
    Wednesday, August 25, 2010 9:37 AM
  • If they retire some part of Visual Studio, they will replace it with something else. (Are 'Installer' projects the same as Setup & Deployment projects?)

    By the way, here's some code you can run to update the icon in add/remove programs. We run this when the application starts up, and we use the same icon that our application displays.

    /// <summary>
    /// set the icon in add/remove programs for all GoldMail products (because this code is only in Akamai for now)
    /// </summary>
    private static void SetAddRemoveProgramsIcon()
    {
      //only run if deployed 
      if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed
         && ApplicationDeployment.CurrentDeployment.IsFirstRun)
      {
        try
        {
          string iconSourcePath = Path.Combine(System.Windows.Forms.Application.StartupPath, "GM_GoldBlueG_multi.ico");
          if (!File.Exists(iconSourcePath))
            return;
    
          RegistryKey myUninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall");
          string[] mySubKeyNames = myUninstallKey.GetSubKeyNames();
          for (int i = 0; i < mySubKeyNames.Length; i++)
          {
            RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true);
            object myValue = myKey.GetValue("DisplayName");
            if (myValue != null && myValue.ToString() == "GoldMailAkamai")
            {
              myKey.SetValue("DisplayIcon", iconSourcePath);
              break;
            }
          }
        }
        catch (Exception ex) {}
      }
    }
    
    

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Izor Wednesday, August 25, 2010 7:24 PM
    • Marked as answer by RobinDotNetMVP, Moderator Wednesday, September 01, 2010 2:45 AM
    Wednesday, August 25, 2010 6:44 PM
  • @RobinDotNet - thanks.  I needed this in a VB.NET app so converted it to VB.NET.  I also tweaked it so it sets the icon for a the specific version this code runs within, for if there are multiple versions of the application installed side by side.

    Sub SetAddRemoveProgramsIcon() 'only run if deployed If ApplicationDeployment.IsNetworkDeployed And ApplicationDeployment.CurrentDeployment.IsFirstRun Then Try Dim iconSourcePath As String iconSourcePath = System.IO.Path.Combine(Application.StartupPath, "<name of your .ico file>") If Not File.Exists(iconSourcePath) Then Return End If Dim myUninstallKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall") Dim mySubKeyNames As String() = myUninstallKey.GetSubKeyNames() Dim i As Integer For i = 0 To mySubKeyNames.Length Dim myKey As RegistryKey = myUninstallKey.OpenSubKey(mySubKeyNames(i), True) Dim registryAppName As Object = myKey.GetValue("DisplayName") Dim registryAppVersion As Object = myKey.GetValue("DisplayVersion") If registryAppName <> Nothing And registryAppVersion <> Nothing And registryAppName.ToString().StartsWith(Application.ProductName) And registryAppVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString() Then myKey.SetValue("DisplayIcon", iconSourcePath) Exit For

    End If Next Catch ex As Exception End Try End If End Sub




    • Edited by Kent E K Thursday, April 10, 2014 9:58 PM Corrected what code does in relation to if multiple versions installed.
    Thursday, April 10, 2014 9:51 PM