有没有办法在“添加或删除程序”中更改ClickOnce应用程序的图标?

我有一个使用ClickOnce技术部署的Windows应用程序。 有没有办法更改图像中显示的该应用程序的图标?

使用图标标记的安装程序的屏幕截图。

以下代码是我用来解决问题的代码。 我在“添加或删除程序”中使用了Stack Overflow问题ClickOnce应用程序的Custom图标

private static void SetAddRemoveProgramsIcon() { //only run if deployed if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed && 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 < mySubKeyNames.Length; i++) { RegistryKey myKey = myUninstallKey.OpenSubKey(mySubKeyNames[i], true); object myValue = myKey.GetValue("DisplayName"); if (myValue != null && myValue.ToString() == "admin") { myKey.SetValue("DisplayIcon", iconSourcePath); break; } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message.ToString()); } } }