본문으로 바로가기

클릭원스로 배포한 프로그램은 프로그램 추가/제거에 아이콘이 등록되지 않는다.
그래서 해당프로그램을 레지스트에 찾아서 아이콘을 등록하여야 한다.
진입부 Main에 추가해서 해당코드를 넣어주면 된다.

    static class Program
     {
         /// 
         /// 해당 응용 프로그램의 주 진입점입니다.
         /// 
         [STAThread]
         static void Main()
         {
             bool created = false;
             Mutex dup = new Mutex(true, "마이프로그램", out created);
 
            if (created)
             {
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 //CheckForShortcut();
                 SetAddRemoveProgramsIcon();  // 여기에 호출 하였다.
참고로 배포시 아이콘을 배포해주고 위치를 지정해주어야 한다.

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.

 /// 
 /// set the icon in add/remove programs for all GoldMail products (because this code is only in Akamai for now)
 /// 
 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) {}
   }
 }
참고사이트 :

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/db1d57ee-7743-4409-8072-f0e84ab5330a/
 
http://blogs.msdn.com/b/oldnewthing/archive/2004/07/09/178342.aspx

'Development > C#' 카테고리의 다른 글

윈도우 시작프로그램 등록 및 삭제  (0) 2012.02.09
Image Source 변경  (0) 2012.02.07
ClickOnce 정보  (0) 2012.01.31
DataGrid 바인딩  (0) 2011.09.27
DataGridView 한글깨짐  (0) 2010.07.21