title: Dynamically Set Taskbar Icon for Windows Application
body: <p>My company has a branding mechanism that sets the icon for a Windows Application, like so:</p>
  
  <pre><code>if (AppBranding.Is("FOO"))
      Icon = MyProject.Properties.Resources.Icon_FOO;
  else
      Icon = MyProject.Properties.Resources.Icon_BAR;
  </code></pre>
  
  <p><code>Icon_FOO</code> and <code>Icon_BAR</code> are resources that point to their respective .ico files. </p>
  
  <p>Also, Icon and manifest in Project > MyProject Properties > Resources is set in Visual Studio.</p>
  
  <p><img src="https://i.stack.imgur.com/9GMsu.png" alt="enter image description here"></p>
  
  <p>When users launch the application, the correct icon appears based on branding. However, if they pin the program to the taskbar, the icon reverts to Icon_FOO.ico, regardless of branding. When they unpin it, the icon toggles back.</p>
  
  <p>I believe that programs pinned to the taskbar use the icon of the .exe, while the icon for the Window is whatever I set <code>Form.Icon</code> to be. I only know how to set the .exe icon by going to Project Properties > Resources and making a selection from the drop down list, as I have in the picture above. How can the icon for the .exe be set dynamically?</p>