Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The following code is what I used for solving the problem. I used Stack Overflow question <em><a href="https://stackoverflow.com/questions/10927109/icon-for-click-once-app-in-add-or-remove-programs">Custom icon for ClickOnce application in 'Add or Remove Programs'</a></em>.</p> <pre><code> private static void SetAddRemoveProgramsIcon() { //only run if deployed if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed &amp;&amp; ApplicationDeployment.CurrentDeployment.IsFirstRun) { try { Assembly code = Assembly.GetExecutingAssembly(); AssemblyDescriptionAttribute asdescription = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code, typeof(AssemblyDescriptionAttribute)); // string assemblyDescription = asdescription.Description; //the icon is included in this program string iconSourcePath = Path.Combine(System.Windows.Forms.Application.StartupPath, "hl772-2.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 &lt; mySubKeyNames.Length; i++) { RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true); object myValue = myKey.GetValue("DisplayName"); if (myValue != null &amp;&amp; myValue.ToString() == "admin") { myKey.SetValue("DisplayIcon", iconSourcePath); break; } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message.ToString()); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload