Visual Studio Icon Patcher
I’ve been a Microsoft based developer now for over 15 years and for at least 10 of those I’ve always looked forward to getting the latest betas and running them right up until the final version came out. Windows, Office, SQL Server, MSN Messenger, Visual Studio, you name it I ran it. That all changed with Visual Studio 2012, and for another day, Windows 8.
When the first beta came out I was blown away by the new direction of the UI. Prior to this Microsoft did make it clear that they were headed in a more unified direction for their UIs and that seemed like a good idea. But one look at Visual Studio and it was evident that there was a lot that still needed to be done.
After installing the beta I opened one of my projects to try it out and no sooner did I open it did I close it. The lack of color in everything made it unusable for me. That was the first and only time I used the beta. I followed some of the posts on the Visual Studio blog about how they were adding more color after the outcry on their User Voice page but none of their updates looked promising. But still, once the RTM was released I had to give it a try and just like with the beta I closed it shortly after opening one of my projects.
Fixing What Microsoft Couldn’t
This is when I got the idea of a plugin that would dynamically change the Solution Explorer icons to something user defined. So my first project was digging through the Visual Studio 2012 SDK in hopes of finding something that could let me do this. After spending almost two weeks in there and coming up empty I figured it was worth a look to see how the icons were stored in Visual Studio 2010. One download of Resource Hacker later and it was clear they were just embedded bitmaps in a couple DLLs. Comparing the 2010 and 2012 DLLs showed that they used the same images in both versions. So using Resource Hacker I changed the images and then opened Visual Studio hoping there were no checks to detect modified files and to my enjoyment my C# console app was showing up with the old icons. Success!
I’ve never been much for contributing to open source projects but this find was begging to be released. If over 10,000 people were willing to complain to Microsoft that they wanted these icons back, or something more closely resembling them, then this was the perfect project to release. After a week or so of playing around with automating the resource injection process, and many, many, Visual Studio install repairs later, the Visual Studio Icon Patcher was born. At the moment it’s a fairly immature tool, but it gets the most offending icons and allows me to use Visual Studio 2012 without hating it.
Since the initial release more locations have been found that contain images that need to be replaced, but they’re all managed DLLs. These can’t be updated using UpdateResource like unmanaged DLLs can. There’s also no built-in way of updating resources in .NET. For now though I’ll leave you with this image, the start of managed DLL patching.
Dark Theme Warning
Instead of using two sets of icons for light and dark, a filter is applied to them based on the tree view background color. If this color is anything but white, or very light grey, then the icons have their white replaced with black. This yields an almost inverted looking icon that is just as displeasing to look at as the ones we’re trying to replace.
There is a bit of a hack for this though which is to dynamically set the background color of the tree view controls though SendMessage. Doing this will revert them back to their original color and the tree view’s background stays dark. The bad news with this method is due to the switch to WPF the Solution Explorer is no longer a win32 control, this means you can’t get a handle to it and use SendMessage like in previous versions.
Not all tree views are WPF though, for instance the Server Explorer and Class View both aren’t, and once their background color is updated to white the icons look normal. So unless there’s a way to do the same with the Solution Explorer this all seems rather pointless. Another option that crossed my mind was a plugin that recreates the Solution Explorer but for now that’s far outside the scope of this project.