The following code fails to create a valid icon recognized by Windows Explorer or VS2005; though, it can be opened in Paint.

using (Bitmap bmp = new Bitmap(@"C:\ABitmap.bmp"))
{
      bmp.Save(@"C:\IconFromBitmap.ico", ImageFormat.Icon);
}

After googling, a post in MSDN forum was found with similar problem http://forums.microsoft.com/msdn/showpost.aspx?postid=63447&siteid=1

The code seems rather straight-forward but it does not appear to do the job.

Does anyone have a solution?