Category Archives: VS 2012

Error “The language is already installed.” installing Visual Studio language packs

As I explained in the following article:

HOWTO: Testing add-ins in localized versions of Visual Studio
http://www.mztools.com/articles/2010/MZ2010003.aspx

Visual Studio 2012 and higher allows to install additional languages (“Tools”, “Options” window, “Environment”, “International Settings” section) through language packs, rather than installing localized full versions of Visual Studio (as in previous versions):

Microsoft Visual Studio 2012 Language Pack
http://www.microsoft.com/en-us/download/details.aspx?id=30681

Microsoft Visual Studio 2013 Language Pack
http://www.microsoft.com/en-us/download/details.aspx?id=40783

When selecting a language other than English, you may find running the downloaded vs_langpack.exe setup the following error:

“The language pack is already installed. To install an additional language, please install the language pack for that language”

LanguagePackError

The problem is happening because you are actually installing the English language pack on an English Visual Studio (notice the title 2013 Language Pack – ENU). It happens that those download pages need some long seconds since you select a language in the dropdown list until the page is refreshed with the corresponding downloadable setup. If you click the “Download” button just after selecting a language in the dropdown list, you actually download the (original) English language pack. Once the page is refreshed, the whole page is localized (including the “Download” button) and then you can download the correct vs_langpack.exe setup.

Notice the amount of unfortunate events in this scenario that can confuse many people:

  • The page needs many seconds to switch the language – a bad design -.
  • No clear indication is provided to the user. The Download button is still visible and enabled.
  • The downloaded setup has the same name “vs_langpack.exe” that doesn’t include the language.
  • The setup error doesn’t say the language that you are trying to install (only the title states the “ENU” language).

Adopting Visual Studio 2012

Finally today, after much reluctance in the past weeks, I have decided to adopt Visual Studio 2012 as the development environment for all my Visual Studio solutions, and I have just migrated them. I still find the default Light theme unpalatable but the Visual Studio 2012 Color Theme Editor extension provides much more pleasant themes and you can even switch themes with a couple of clicks.

What prompted me to the move was that Packt Publishing gave me a copy of the book Visual Studio 2012 Cookbook of fellow MVP Richard Banks to write a review and after reading the first chapter about the new IDE enhancements in the Solution Explorer and Tab Well I realized they were too good to miss the opportunity to use them on a daily basis.

MZ-Tools Articles Series: HOWTO: Get an inverted bitmap to use with the Dark theme of Visual Studio 2012 from an add-in.

There is a feature in my MZ-Tools add-in that requires to show the pictures of its commands in a treeview, to select which ones to be visible or not. When using Visual Studio 2012 and the Dark theme, the background of the form and the treeview are darked, and the bitmaps should have inverted colors.

I wanted to reuse the command pictures and use a function that inverts their colors as VS 2012 does. I knew the ThemeDIBits method of the IVsUIShell5 interface, but it took me a while to discover a Visual Studio assembly that used it. Finally I found it and here is the approach:

HOWTO: Get an inverted bitmap to use with the Dark theme of Visual Studio 2012 from an add-in.
http://www.mztools.com/articles/2012/MZ2012030.aspx

The sample also shows how to get the background color of toolwindows, using also the IVSUIShell5 interface.

Note: my command pictures use the almost green (RGB=0,254,0) to denote the transparent color, and the sample provided uses that color, but you can use any color.

MZ-Tools Articles Series: BUG: Visual Studio 2012 doesn’t theme multiline textbox with initial scrollbar on add-in toolwindow.

This is one of the bugs that I found while theming my MZ-Tools add-in with VS 2012 Dark / Light themes:

BUG: Visual Studio 2012 doesn’t theme multiline textbox with initial scrollbar on add-in toolwindow.
http://www.mztools.com/articles/2012/MZ2012028.aspx

UnthemedScrollbar

And here it is the bug that I have filed through Microsoft Connect to be fixed:

Visual Studio 2012 doesn’t theme multiline textbox with initial scrollbar on add-in toolwindow
https://connect.microsoft.com/VisualStudio/feedback/details/766960/visual-studio-2012-doesnt-theme-multiline-textbox-with-initial-scrollbar-on-add-in-toolwindow#details

Fortunately I found an easy workaround that I have mentioned in the article.

MZ-Tools Articles Series: HOWTO: Get the Microsoft.VisualStudio.Shell.Interop.IVsUIShell5 interface to theme a Visual Studio 2012 add-in.

Another building block that I have used to theme my MZ-Tools add-in with the Visual Studio 2012 Dark/Light themes:

HOWTO: Get the Microsoft.VisualStudio.Shell.Interop.IVsUIShell5 interface to theme a Visual Studio 2012 add-in:
http://www.mztools.com/articles/2012/MZ2012027.aspx

In a next article I will explain how to invert the colors of a bitmap like VS 2012 does.

MZ-Tools Articles Series: HOWTO: Theme scrollbars of controls on a Windows Forms modal window from a Visual Studio 2012 add-in.

I had pending for weeks to theme scrollbars of controls of my MZ-Tools add-in on modal forms (Visual Studio 2012 automatically themes scrollbars of controls on toolwindows) and finally yesterday I decided to devote some time to the investigation. Here is the answer:

HOWTO: Theme scrollbars of controls on a Windows Forms modal window from a Visual Studio 2012 add-in.
http://www.mztools.com/articles/2012/MZ2012026.aspx

MZ-Tools Articles Series: BUG: EnvDTE.FontsAndColorsItems.Item(“Keyword”).Background not updated after changing Visual Studio 2012 theme.

One of the things that you need to test in a Visual Studio 2012 add-in or package is that is themed correctly when the VS theme is changed dynamically from Dark to Light or viceversa (through the Tools, Options window). I noticed that sometimes the textboxes that show colorized C# or VB.NET code in my MZ-Tools 7.0 add-in were showing an incorrect background for strings, comments and keywords. I use the RichTextBox control and I get the color information from the EnvDTE.FontsAndColorsItems class, as explained in the article:

HOWTO: Get the text editor font and colors information in a Visual Studio add-in
http://www.mztools.com/articles/2008/MZ2008008.aspx

After reading this thread in the VSX forum, I realized that it happened when switching themes. And today I have filed a bug to Microsoft Connect:

EnvDTE.FontsAndColorsItems.Item(“Keyword”).Background not updated after changing theme
https://connect.microsoft.com/VisualStudio/feedback/details/765401/envdte-fontsandcolorsitems-item-keyword-background-not-updated-after-changing-theme#details

And I have documented it here with the workaround that I am using:

BUG: EnvDTE.FontsAndColorsItems.Item(‘Keyword’).Background not updated after changing Visual Studio 2012 theme
http://www.mztools.com/articles/2012/MZ2012025.aspx

The workaround is not perfect but I also played with the RefreshCache method of the IVsFontAndColorCacheManager interface to no avail.

Cyan: Another magic color for developers of Visual Studio 2012 add-ins

So far there were two magic colors to be known by developers of Visual Studio add-ins:

Ryan Molden (Visual Studio team) posted in a comment here explaining that you can exclude a custom bitmap of a command from being color-inverted in Visual Studio 2012 when using the Dark theme setting the top-right pixel of the picture to the Cyan value (RGB = 0, 255, 255). This allows you to create an add-in that appears colorful both with the Dark and Light themes, provided that the borders appear fine with dark background (you can use ARGB bitmaps with partial opacity if needed).

I have updated the first article to include this information.

MZ-Tools Articles Series: HOWTO: Get the bitmap of a component type from Visual Studio add-in

Continuing with the problems introduced by the new gray icons of Visual Studio 2012, my new article explains the approach that Microsoft used to solve this problem that I reported:

Document Outline toolwindow of VS 2010 shows icons of VS 11 Beta (gray)
https://connect.microsoft.com/VisualStudio/feedback/details/735124/document-outline-toolwindow-of-vs-2010-shows-icons-of-vs-11-beta-gray

My MZ-Tools add-in provides a Control Explorer feature that is like the Document Outline feature of Visual Studio but enhanced (multi-selection, property grid with most used properties, etc.). After weeks theming MZ-Tools icons, toolwindows and modal forms, the last piece was how to get the gray icons of controls and components in the treeview of that feature like the Document Outline does, rather than the colored ones. It took me several hours of investigation but I figured it out:

HOWTO: Get the bitmap of a component type from Visual Studio add-in
http://www.mztools.com/articles/2012/MZ2012022.aspx

Incredible as it is, while the Document Outline of Visual Studio 2012 uses that approach, the Toolbox doesn’t. The gray icons of the System.Windows.Forms controls used in the VS 2012 toolbox seems to be stored in a unmanaged resource dll (Microsoft.VisualStudio.Windows.FormsUI.dll in the folder C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\1033). I don’t know why yet but I will investigate it some other day (all this is quite exhausting).

Dark/Light themes headaches in Visual Studio 2012

On Sep 12 Microsoft launched Visual Studio 2012, arguably the ugliest Visual Studio version ever launched according to very strong feedback from the community of developers. For the first time Visual Studio added support for themes. It is arguable if individual applications should be themed, or if themes should be provided by the operating system and applications should just be themed automatically. Anyway, Microsoft Office initiated that path a few years ago with Office 2007 (own theme and fonts) and Visual Studio followed suit. The problem is that rather than providing full support for themes, Microsoft has just supplied two themes (Light and Dark) that provide new icons and lack color, and it hasn’t provided a Visual Studio 2010 theme. Not everybody likes the new icon style, and Microsoft has been reluctant to add color (some in the Release Candidate and apparently there is more coming slowly). Furthermore, after people complaining about ALL CAPS captions in toolwindows, the fix was to make the main menu all caps instead.

Since then, two development efforts in opposite directions are happening:

On the one hand, people that find VS 2012 unpalatable are trying to get back color and icons to the IDE:

– You can now use multiples themes (not just Dark/Light) using the Visual Studio 2012 Color Theme Editor available on the Visual Studio Gallery.

– Some people are even patching the icons of VS 2012 to replace them with the ones of VS 2010: Visual Studio Icon Patcher, a so crazy idea that can even work.

-Note: Microsoft provided a registry entry to remove the ALL CAPS of top menus (HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\SuppressUppercaseConversion, REG_DWORD value: 1), so no Visual Studio extension is required for that.

On the other hand, developers of extensions (like me) are working hard (that is, weeks or months) to adapt our add-ins, packages, etc. to the themes of Visual Studio. I have spent the last weeks doing it with MZ-Tools 7.0 and I have learned quite a bit that I will share in next posts, but suffice to say that theming Visual Studio extensions is quite a headache, even for Microsoft. For example, while all Visual Studio 2012 toolwindows are themed, only a few modal forms are (New Project, Add Reference, etc.) but many others are not (most notably, the Options window). This is because new forms use WPF while old forms use Windows Forms, and not all Windows Forms controls are well suited for themes (TabControl tabs, ListView header, disabled controls), so it is tricky, specially if you don’t own all the content of a modal form.

Microsoft has had also issues with the new themes, like these ones that I have reported, some of which were fixed for the RTM:

Document Outline toolwindow of VS 2010 shows icons of VS 11 Beta (gray)
https://connect.microsoft.com/VisualStudio/feedback/details/735124/document-outline-toolwindow-of-vs-2010-shows-icons-of-vs-11-beta-gray

(this was fixed with a convoluted hack that I will explain in a future post/article)

And others are not fixed yet:

Document Outline dropdown menus with black forecolor with Dark theme
https://connect.microsoft.com/VisualStudio/feedback/details/764325/document-outline-dropdown-menus-with-black-forecolor-with-dark-theme#details