OK, today's teaser: How do you get the new 256x256 icons to work in a .NET application with Visual Studio 2005?
Here's the answer:
- Download ReplaceVistaIcon from CodeGuru.
- Set the application icon to "(Default Icon)" in the project properties / Resources / Icon.
- Set the Build Action for the icon to "None". This will let you keep the actual file in the project.
- Add the following to a post build event (and modify any paths to match your system). You can omit the second line if you are not signing your assembly.
- C:\Util\ReplaceVistaIcon.exe "$(TargetPath)" "$(ProjectDir)\IconVista.ico"
- "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\SN" -R "$(TargetPath)" "$(ProjectDir)\MyKey.snk"
If you have other icons with a Build Action of "Resource" you will need to find out what the application icon ID is and append that to the first line. One way to dig this up is to use Visual Studio:
- Click on the File menu, and then click Open, and then click File....
- Browse to your compiled file.
- Expand [MyApplication.exe], and then expand Icon.
- Write down the number in front of the first icon.
All of this assumes that you have an icon editor that can actually create icons with 256x256 compressed PNG images. The reason you need to do this is because the .ico file format is a little "hacked" for Vista to maintain compatibility with Windows XP.