Visual Commander v1.6 adds common code modules for commands and extensions

Visual Commander is a freemium extension for Visual Studio 2010+ allowing you to automate repetitive tasks in the IDE.

Visual Commander Professional v1.6 adds the ability to create common code modules that can be reused from different commands and extensions:

A common code module in Visual Studio 2013

A common code module in Visual Studio 2013

Visual Commander v1.6 also adds the ability to run commands directly from the Commands window by double-clicking or with the new Run button.

Download the installer.

Posted in Vlasov Studio tools | Tagged , , , | Leave a comment

Visual Studio 2010 Macros Stop Working after February 2014 Windows Update

Installing recent February 11, 2014 Windows updates breaks Visual Studio 2010 macros functionality. Macros just don’t run any more without an error message. More specifically, it is MS14-009 update “Vulnerabilities in .NET Framework Could Allow Elevation of Privilege (2916607)” (rated as Important) breaks macros. And more specifically it is the Elevation of Privilege part of this update.

MS14-009 includes several updates for different OS and .NET versions. To restore Visual Studio 2010 macros functionality you need to uninstall the Elevation of Privilege patch specific for your machine. For example, on a Windows 8.1 machine you need to uninstall KB 2898871:

Uninstalling KB2898871 Windows Update

Uninstalling KB2898871 Windows Update

Windows update to uninstall to restore macros functionality in Visual Studio 2010
.NET 4.5.1 .NET 4.5 .NET 4
Windows 8.1 KB2898871
Windows 8 KB2898870 KB2898865
Windows 7 KB2898869 KB2898864 KB2898855
Windows XP KB2898855

The Visual Commander extension (a modern alternative to Visual Studio macros) is not affected by this Windows update.

Update (February 18): To restore Visual Studio 2010 macros functionality without removing Windows updates, you can add the AllowDComReflection configuration setting (published by Jens) to vsmsvr10.exe.config, vsaenv10.exe.config and devenv.exe.config files (note, you need to run your editor with admin rights for correct modification of these files):

<configuration>
    <runtime>
        <AllowDComReflection enabled="true"/>

On a 64-bit Windows machine default paths to these files are:

"C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\vsmsvr10.exe.config"
"C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\vsaenv10.exe.config"
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config"

Each of these files already has the runtime section, you just need to add the <AllowDComReflection enabled="true"/> line:

Adding AllowDComReflection to vsmsvr10.exe.config

Adding AllowDComReflection to vsmsvr10.exe.config

To restore Visual Studio 2008 macros functionality, you need to add AllowDComReflection to the following files:

"C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\vsmsvr.exe.config"
"C:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\vsaenv.exe.config"
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.config"

Update (February 25): Microsoft published KB2934830 “Marshaling of reflection types may not work over DCOM after you install a security update from security bulletin MS14-009″. It acknowledges that macro functionality in Microsoft Visual Studio may not work as expected after installing MS14-009. As a workaround to restore the functionality of Visual Studio macros, the article suggests updating one of the following application configuration files, depending on the version of Visual Studio that is installed on the system:

Visual Studio 2010 c:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\Vsmsvr10.exe.config
Visual Studio 2008 c:\Program Files (x86)\Common Files\Microsoft Shared\VSA\9.0\VsaEnv\Vsmsvr.exe.config
Visual Studio 2005 SP1 c:\Program Files (x86)\Common Files\Microsoft Shared\VSA\8.0\VsaEnv\Vsmsvr.exe.config

You need to add the AllowDComReflection configuration switch in the <runtime> section of an .exe.config file as follows:

 <?xml version ="1.0"?>
 <configuration>
     <runtime>
         <AllowDComReflection enabled="1"/>
     </runtime>
 </configuration>
Posted in Visual Studio news | Tagged , | 62 Comments

Continuous code formatting for Visual Studio

The new Continuous Formatting extension automates C# and C++ code formatting in Visual Studio 2013/2012/2010. It removes the necessity to format code (and reformat, and reformat again) manually, arranging code continuously as you type and make changes. More importantly, it allows you not to think about code layout and concentrate on more important software development activities.

At the moment Continuous Formatting uses the built-in Visual Studio code formatting engine that is controlled by standard text editor formatting options. I plan to add support for external code beautifiers as well.

Download the installer.

Posted in Vlasov Studio tools | Tagged , , , | Leave a comment

Visual Studio Class View and Object Browser Icons

A good reference for Visual Studio icons related to code, available for different versions of Visual Studio.

Posted in Visual Studio tips | Leave a comment

Visual Studio code formatting options per solution, directory and file

Visual Studio supports only one global set of code formatting options. If you work on several projects/solutions with different formatting styles, you need to change global text formatting options each time you change projects:

Code formatting options in Visual Studio 2013

Code formatting options in Visual Studio 2013

If you work on a small fixed number of projects, you can automate options change with a macro or Visual Commander command, see Setting Indent Width and Tabs/Spaces Quickly Using Macros by Alexander GroƟ:

Dim textEditor As Properties
textEditor = DTE.Properties("TextEditor", "AllLanguages")
textEditor.Item("IndentStyle").Value = vsIndentStyle.vsIndentStyleSmart
textEditor.Item("TabSize").Value = 4
textEditor.Item("IndentSize").Value = 2
textEditor.Item("InsertTabs").Value = False

The new Rebracer extension by Schabse S. Laks can store code formatting options in a separate file in the solution directory and automatically load these options with the solution. If you want to set solution specific formatting options, just change global Visual Studio options and Rebracer will remember them for your solution. You can store the Rebracer.xml file with saved options in your source control repository along with the solution and share with others:

Saved code formatting options by Rebracer in Visual Studio 2013

Saved code formatting options by Rebracer in Visual Studio 2013

You can download Rebracer from Visual Studio Gallery. Source code and additional FAQ are available on GitHub.

EditorConfig Visual Studio extension supports per directory and per file code formatting settings based on the EditorConfig standard. When you open or activate a document in Visual Studio, EditorConfig sets Visual Studio text formatting options based on the .editorconfig file stored with your source files:

; Top-most EditorConfig file
root = true

; 4-column space indentation
[*.cs]
indent_style = space
indent_size = 4

Only indent_style, indent_size, tab_width and end_of_line text formation options are supported. Unfortunately, the current version 0.3.1 on Visual Studio Gallery doesn’t work. You can download patched v0.4.1 for Visual Studio 2013 here (I downloaded it here and removed dependency on MPF 11.0 from extension.vsixmanifest).

Posted in Reviews | Tagged , | Leave a comment

Visual Commander v1.5 adds navigation to relevant code from compiler errors

Visual Commander is a freemium extension for Visual Studio 2010+ allowing you to automate repetitive tasks in the IDE.

Visual Commander Professional v1.5 adds the ability to double-click on a compiler error in the Compilation status box and navigate directly to the relevant code (line and column of the error):

Navigation to relevant code from a compiler error

Navigation to relevant code from a compiler error

Visual Commander v1.5 also adds recording for the Edit.FormatSelection and Edit.FormatDocument commands, improves alignment for displayed command bindings in the main VCmd menu.

Download the installer.

Posted in Vlasov Studio tools | Tagged , , , | Leave a comment

Show all mnemonics in Visual Studio .rc dialog designer for native C++ code

“Normally, keyboard users move the input focus from one control to another in a dialog box with the TAB and ARROW keys. However, you can define an access key (a mnemonic or easy-to-remember name) that allows users to choose a control by pressing a single key.”

For WPF dialogs you add underscore (_) in front of the letter you want as the access key for a control and you can display all mnemonics in the designer (an underline appears in the displayed caption to indicate the access key) pressing the Alt key:

WPF dialog designer in Visual Studio 2013

WPF dialog designer in Visual Studio 2013

For Windows Forms dialogs you add ampersand (&) in front of the letter you want as the access key and the designer always shows all assigned mnemonics:

Windows Forms dialog designer in Visual Studio 2013

Windows Forms dialog designer in Visual Studio 2013

For native C++ .rc dialogs you add ampersand (&), but there is no way to show all assigned mnemonics. Only the Check Mnemonics command is available to check for duplicate access keys:

Check Mnemonics command for native dialog designer in Visual Studio 2013

Check Mnemonics command for native dialog designer in Visual Studio 2013

The Show mnemonics command for Visual Commander displays all mnemonics for a native dialog in Visual Studio 2010/2012/2013 designer:

All mnemonics displayed for native dialog designer in Visual Studio 2013

All mnemonics displayed for native dialog designer in Visual Studio 2013

You can download the Show mnemonics command as a .vcmd file and quickly import to Visual Commander. (Thanks to Sven Ritter for the original idea of activating mnemonics with a WM_UPDATEUISTATE message.)

Posted in Vlasov Studio tools | Tagged , , , , | Leave a comment