Export Custom Well regex in Productivity Power Tools - visual-studio

Is there any way to export the coloring rules for the Productivity Power Tools's component: Custom Well?
I have quite a sophisticated configuration and it's always a pain to move it to another computer or to the new version of Visual Studio.
I have tried to export this particular setting using the Import and Export Settings of Visual Studio, but cannot locate it there. At he same time, I would prefer not to export/import all the VS settings.
I guess that would be a simple copy paste of one file, but not sure where to look for it.
Copy pasting row by row is the last resort, as for each of the colors you need to manually choose it in the picker (terrible design).

After further research I have found out that the color/regex settings are stored within the registry, under:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\DialogPage\Microsoft.CustomDocWell.Options\Colors
(for Visual Studio 2015; for the earlier versions, change 14.0 to the desired version number). Those registry settings can be simply exported/imported as any other.
However, the situation differs with the Visual Studio 2017, where the registry structure has been changed. The keys are still there, but it gets a bit more complex to get there. You can read more on the topic here:
https://visualstudioextensions.vlasovstudio.com/2017/06/29/changing-visual-studio-2017-private-registry-settings/

In VS 2017, you'll have to follow the instructions in
https://visualstudioextensions.vlasovstudio.com/2017/06/29/changing-visual-studio-2017-private-registry-settings/
given by mikus, then the Regex will be in the key like:
HKEY_LOCAL_MACHINE\_TMPVS_15.0_116e7493\Software\Microsoft\VisualStudio\15.0_116e7493\DialogPage\Microsoft.CustomDocWell.Options\Colors
But NOTE : you may have to add a new regex in visual studio options (Productivity Power Tools -> Custom Document Well -> Color Coding) before this key shows up.

Related

Using visual studio 2019 in dark mode with high contrast in Windows 10

Is there anyone who is using Visual studio 2019 in dark mode with High contrast?
If yes, can you tell me exactly how to do that?
As far as I know, Visual studio doesn't have an option to use High contrast for dark mode (it's there only for blue theme which I don't want).
And also if I change my Windows OS to use high contrast mode and come back to Visual studio, and then by default VS adjusts itself to high contrast but it's very poor to read (it reads like plain white text on a black blackground devoid of any other colors)
I was wondering if there's something in VS 2019 which is similar to Visual studio code high contrast mode or maybe IntelliJ Idea which is very user friendly and serves the purpose.
Thanks in advance.
You can enable dark mode in the VS2019 by modifying a private registry in a next way:
Close all instances of VS2019
Press Ctrl+R and run regedit
Expand HKEY_USERS elements in the tree
File -> Load Hive...
In the dialog navigate to C:\Users\<UserName>\AppData\Local\Microsoft\VisualStudio\16.0_XXXXXXXX and load privateregistry.bin file. It will ask you to give some name, for example, "vs2019". (it might be useful to store somewhere a copy of privateregistry.bin file for backup)
Export te “Dark” theme registry key: HKEY_USERS\vs2019\Software\Microsoft\VisualStudio\16.0_????????_Config\Themes\{1ded0138-47ce-435e-84ef-9ec1f439b749}
Replace the GUID of the “Dark” theme ({1ded0138-47ce-435e-84ef-9ec1f439b749}) with the GUID of the “High Contrast” theme ({a5c004b4-2d4b-494e-bf01-45fc492522c7})
Import the reg file
Important: Click on vs2019 -> File -> Unload Hive...
Note, it might happen after Windows or VS updates, your setting will be erased. In this case, you need only to load hive, import modified file from step 7, and don't forget to unload hive.
Inspired by this post: Visual studio 2017 high contrast theme dark registry hack
Visual Studio likes resetting this pretty often so I made a cmd script that lets you select what theme to override 'High Contrast' with instead of doing all of those steps manually each time.
Get the script here.
The most clean way is to modify the current used theme as this is the behaviour Visual Studio executes when changing themes in the settings.
Close all instances of Visual Studio 2019 / 2022
Press Ctlr+R and run regedit
In the node tree, expand HKEY_USERS
Press File -> Load Hive...
In the dialog navigate to C:\Users\<UserName>\AppData\Local\Microsoft\VisualStudio\16.0_XXXXXXXX or if you use Visual Studio 2022 C:\Users\<UserName>\AppData\Local\Microsoft\VisualStudio\17.0_XXXXXXXX and load the privateregistry.bin file. It will ask you to give some name, for example, "vs2019". (before proceeding a backup of the privateregistry.bin file is advised)
Navigate to HKEY_USERS\vs20xx\Software\Microsoft\VisualStudio\1x.0_xxxxxxxx\ApplicationPrivateSettings\Microsoft\VisualStudio
There, set the value of ColorTheme and ColorThemeNew to 0*System.String*1ded0138-47ce-435e-84ef-9ec1f439b749 and 0*System.String*{1ded0138-47ce-435e-84ef-9ec1f439b749} respectively. If you wish any other color please check HKEY_USERS\vs20xx\Software\Microsoft\VisualStudio\1x.0_????????_Config\Themes\ for the theme IDs.
Click on the loaded node in the node tree named vs20xx and then File -> Unload Hive...
This will change the setting in Visual Studio to use a different theme instead of changing the themes themselves and will most likely be persistent after updates.

Export Visual Studio's 'Code Style settings' as .editorconfig

Our team works with Visual Studio 2017 Professional.
I've been trying to unify the Code Style across the team and apparently the industry standard right now is to use .editorconfig files. Even Visual Studio in it's settings windows suggests to use that configuration file and links to a useful page on how to write an editorconfig file.
but I don't want to write all the settings that I already have configured in VS by hand. I would like a tool that exports those settings as a .editorconfig file to distribute them.
I haven't been able to find any tool to do just that so I thought on righting it myself and share it with other people like me. But apparently if go to "Tools -> Import and Export Settings..." you can't download your current Code Style settings.
Is there a way around this?
do you know any tool to convert my settings to an editorconfig file or a way to export my current Code Style settings?
Edit
I have created my own version of the .editorconfig file based on the information found in here
You can find it in my github repo
I realise this isn't much help for VS2017 users, but VS2019 has a button "Generate .editorconfig file from settings" on the Code Style options page:
This options page is available at Tools > Options > Text Editor > [C# or Basic] > Code Style > General.
I know this question is ancient but worth an answer...
The latest Visual Studio extension allows you to do this (Guide here):
Basically install the extension and right click on the solution or project (you can restrict the rules to solution/project or even folder) and click add > new EditorConfig (IntelliCode)
There are still some restrictions about what you can do in the latest releases of Visual Studio, but Visual Studio 2017 15.8 Preview 3 or higher allow you to use a new extended “Format Document” command to perform additional code cleanup for the current document.
It's a shame you can't make all your rules cause build errors, only some of the options allow this - without this, a lot of the styling options can be ignored.

VS2010 Only show file names in tabs

My website has several nested folders and sometimes long file names, so sometimes only 4 tabs can be opened at a time.
Can vs2010 be made to show only file names and leave out any path information?
Can the max displayed length for tabs be set?
I know the window can be split so top and bottom both have their own tabs.
For example (using the "Visual Studio 2010 Pro Power Tools"):
Showing the files:
...r.aspx.cs
...s.aspx.cs
...s.aspx.cs
...s.aspx.cs
...s.aspx.cs
For example (not using the Visual Studio 2010 Pro Power Tools):
Showing the files:
Adminstration/...quests.aspx.cs
Adminstration/...tUsers.aspx.cs
Adminstration/...ctions.aspx.cs
Adminstration/...eBanks.aspx.cs
Try installing the "Visual Studio 2010 Pro Power Tools" extension from the Extension Manager in VS. It adds a new section to the standard option dialogue that allows you to customise what they call the "Document Tab Well."
It doesn't let you truncate the filename, but you can change the way they draw and scroll, which might be enough to help.
It does allow more tabs at a time, but it severly shortens the amount of file name you see. So while it allows editing more files, you won't know what file you are editing.
For now I'm using the trial version of Tab Studio
In VS2010, go to Tools - Extension Manager. Go to the online gallery and search for this extension:
Visual Studio 2010 Pro Power Tools
This extension, once installed, gives you extensive control over the document well, including setting a max tab width and much more. I love this extension, and have had zero issues customizing tab behavior to suit my preferences. Hope this helps.
Fixed in Visual Studio 2012
This has finally been fixed in Visual Studio 2012:
So i see:
PendingRequests.aspx (rather than ...r.aspx.cs)
ImportUsers.aspx.cs (rather than ...s.aspx.cs)
SearchTransactions.aspx.cs (rather than ...ctions.aspx.cs)
ImportTimeBanks.aspx.cs (rather than eBanks.aspx.cs)
Now if we could just get the entire Visual Studio ecosystem to:
return to the use of Left, Right arrows to navigate overflow tabs
open new tabs on the right
just like Windows has been doing in 1994, and Visual Studio would start to almost become a user-friendly Windows application.
I have been using this excellent extension for VS2010 that solve your problems: Visual Studio 2010 Pro Power Tools.
It is a bundle of several extensions, but the most notable for you is the Document Well 2010 Plus. It allows you to configure the document tabs: to be the constant width, colour-coded by project, pinned, etc...
You can toggle the extensions that you do not want by editing the manifest file in:
~\Local Settings\Application Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\Visual Studio 2010 Pro Power Tools\
#IanBoyd: I agree, it doesn't solve the problem 100% however it helps (which is why most of the answers to this question suggest it). With the Visual Studio 2010 Pro Power Tools add-on you can a) set the maximum tab width using one tab options, b) setup some colour categorizing rules to help differentiate between projects/file types.
In VS2010, my workflow relies upon several add-ons and keyboard shortcuts to manage my workspace; for example I use CTRL + Tab to switch between active documents, use the pin-tab feature and colour coding from Power Pro Tools, the open solution file dialog from Visual Assist X, and re-open last edited file from Resharper.
This has been answered already here:
Remove path from tab name in Visual Studio 2010
Install the productivity power tools extension and it should do it by default!
Cheers.

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

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?
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
You can open visual studio with a special "reset" settings file which overrides the default settings. Using this method it is possible to create two shortcuts, one with each tab setting. Details are here.
I'm afraid you can't do that on a per-project basis.
But, with Tools/Import and Export Settings... you can export each settings in a file and you could import the one that fits your current project.
Visual studio 2017 adds .editorconfig support, which is very handy for such settings.

How to Export/Import Toolbars in Visual Studio

I export my settings in Visual Studio and if I ever move to a new machine or have problems, I use those backed up settings to restore Visual Studio to the way I like it. It also allows me to maintain a consistent development environment between the various machines that I use.
This works great for keybindings, syntax highlighting, user tools, pretty much everything except for the toolbar locations and customizations. Whenever I move to a new machine and restore the settings, the toolbars are not affected. I have spent a fair amount of time setting up toolbars with my macros, external tools, etc and cut'n'pasted icons in for them. I hate losing all that work.
Does anybody know how to back up and restore the toolbars' locations and customizations? If it is not a feature of Visual Studio, is there an addin that will do the job?
Edit
As mentioned below, the Menu and Command Bar Customizations in Import and Export Settings is supposed to do this, but when I re-import my previous settings, I get
Error 1: Menu and Command Bar Customizations: The version of command bar settings being imported is not supported. All the command bar settings have been ignored.
The settings I am trying to re-import were exported earlier this month with the same version of Visual Studio. The only difference is that I am now running 64 bit as opposed to x86. I didn't think that would make a difference though since the settings files are XML.
Any ideas?
I have finally found the solution to this. There is a known bug in Visual Studio and there are two workarounds given. The first workaround does not apply, but the second worked.
To Backup your toolbars:
Copy the file CmdUI.PRF from the path %AppData%\Microsoft\VisualStudio\X.Y\1033 to the same directory as your exported .settings file.
where X.Y is either of 8.0, 9.0, 10.0 or 11.0 depending on your visual studio version (2005, 2008, 2010 and 2012 respectively).
To Restore your toolbars:
Make sure Visual Studio is closed and copy the backed up file back to the original location.
For the benefit of others, as you mentioned this feature doesn't seem to be supported across versions of Visual Studio, presumably because of a change in the DTD/XSD for the settings file? At any rate, here's where the settings for your custom toolbars lie in the "Import and Export Settings..." dialog:
Note: Your options may look different, depending on the settings you exported.
I have not tried it, but "Tools\Import and Export Settings..." maybe will let you export a .vssettings file you can then take to another box.
See also
http://blogs.msdn.com/saraford/archive/2005/04/19/409887.aspx
and other Sara 'export' tips.

Resources