CSharpFeeds - All your C# feeds in one place.

Sponsors

Tuesday, October 02, 2007

Visual Studio Add-in C# Code Template

by Keyvan Nayyeri via Keyvan Nayyeri on 10/2/2007 4:14:29 PM

Yesterday, Bill Bridges (Development Editor of my new book) sent me an email about a problem in one of the recent chapters of my upcoming book about Visual Studio Extensibility.  The problem, that had taken half an hour of his time to get fixed was a simple formatting problem in one of source code samples.  A a non-technical man, he was honest to change all lines of a source codes manually one by one.  Book publishers like to use spaces for code indentations not tabs.  In that chapter, one code sample listing had this problem and had tabs for indentations.  Actually this was a problem by Microsoft not me and I was aware of the exact problem but had forgotten to apply the fix to that listing (while had applied the correct formatting to other listings).

But the problem was with the default code template formatting and indentations for Visual Studio add-in C# code template.  By default, this code template has a different formatting than other code templates in Visual Studio and you need to reformat the code in order to make it similar to other codes.

The default code template uses tabs for indentations while all other code templates in Visual Studio use spaces.  This problem is specific only to add-in C# code templates and I couldn't find it in other add-in code templates like Visual Basic code template.  On the other hand, Visual Studio 2005 had this problem as well.

Here is the default code template which uses tabs for indentation:

Code Before Formatting

And this is the code after formatting the document by pressing Ctrl + E, Ctrl + D respectively:

Code After Formatting

I write about that issue here to spread the word and hope that Visual Studio Extensibility team apply a simple change to solve this inconsistency for next versions of Visual Studio.

email it!bookmark it!digg it!

Original Post: Visual Studio Add-in C# Code Template

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us