Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use different tab settings in different projects in Visual Studio

Tags:

The Visual Studio options dialog allows you to set tab preferences (size, insert-spaces, etc.) on a per-language basis. But I am regularly working on a couple of c# projects with different settings for these values.

Is there a way to override the global settings on a per-project basis, or at least toggle between them easily?

like image 205
Gabe Moothart Avatar asked Aug 11 '09 20:08

Gabe Moothart


People also ask

How do I change the default tab size in Visual Studio?

Underneath "Text Editor", expand the "All Languages" heading. Underneath "All Languages", select the "Tabs" item. In the textboxes on the right, fill in the tab size and indent size that you want to use.

How do I get to project settings in Visual Studio?

You access project properties by right-clicking the project node in Solution Explorer and choosing Properties, or by typing properties into the search box on the menu bar and choosing Properties Window from the results. . NET projects might also have a properties node in the project tree itself.


1 Answers

Another approach may be through the extensibility API: it should be possible to write a macro or add-in that changes these settings.

E.g. to change the tab size to 6, use the following:

    DTE.Properties("TextEditor", "CSharp").Item("TabSize").Value = 6 

Here's a link that explains how to find out the names of the properties: http://support.microsoft.com/kb/555445

like image 79
jeroenh Avatar answered Sep 20 '22 01:09

jeroenh