What is the order of precedence for Visual Studio settings?
I know of several areas that Visual Studio settings come from, but it's not clear what to expect for precedence. It would also be helpful to be able to see where a particular setting is being taken from.
For example, I have both a .editorconfig file and a Visual Studio settings item (i.e., from Tools->Options) that specify tabs vs spaces settings for code. Sometimes files converted to use tabs and other times they're converted to use spaces, all in the same project, all during the same working session. Ideally I'd be able to specify values in .editorconfig and that would be of highest precedence. Can I make that happen?
Related
Visual Studio 2019 can be configured in many ways via settings. Is there a simple way to find out which settings differ from the default settings?
I’m looking for a similar method as Open Settings (JSON) in Visual Studio Code. Open Settings (JSON) in Code only contains the options which differ from the defaults.
What I have tried is the comparison between the exported settings from a new workstation and from an existing one, but the exported xml files contain too much noise.
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.
Visual Studio gives us this great ability to completely customize our work environment, including how we wish to format whitespace. I am very particular about how and where I want tabs, spaces, braces, etc. to appear.
For instance, I prefer tabs to be inserted as tabs not spaces. I also prefer the indentation (Tab size/Indent size) to only be 2 spaces (frankly I don't need 4 spaces to see that the line has been indented).
This is all well and good until I work collaboratively. Everyone else I work with just seem to use the defaults for whitespace/formatting. This causes problems when using source control like TFS. If you compare files worked on by me and then a co-worker, the changes in whitespace also show up. I don't want to see these changes; they're not significant.
Please don't tell me the answer is that the entire team should use the same settings. This isn't the correct answer. That answer is a cop-out for bad design. Why have the ability to customize your environment if everyone is forced to use the same settings?
Why doesn't TFS (or any other source control) remove unnecessary whitespace before committing a file based upon the file type? This has several benefits. One, the storage required to hold the file is less. Two, the transmission of the file to the source control server should be more efficient since the file is smaller (these first two benefits are probably negligible since the files are probably compressed anyway). Three, and most importantly, TFS (or any source control) will no longer report changes in whitespace when doing a file diff.
When I view/edit the file in my environment, it will be reformatted how I've defined it. When someone else views/edits the file, it will be reformatted to their specification.
Is there a way to do this currently in TFS?
Although what you said about is very reasonable, I still want to say the best solution is to get the entire team to use the same standards for white space in code. After all, you are teams.
If you insist on it, below is a workaround that to this problem (only works on your local machine).
In Visual Studio, select Tools / Options / Source Control / Visual Studio Team Foundation System and click the Configure User Tools button.
In the dialog, Add an item with the following settings.
Extension : .*
Operation : Compare
Command : C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
Arguments : %1 %2 %6 %7 %5 /ignorespace
Depending on your Visual Studio version and instalation path (x64/x86), the command option may be...
VS2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
VS2012: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\diffmerge.exe
VS2013: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsDiffMerge.exe
VS2015: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsDiffMerge.exe
In the argument option leave it with the same number of arguments as the VS suggests and just add /ignorespace in the end. For example, in the VS2015 it will be:
%1 %2 /ignorespace
More details you can refer this blog: Configure Diff to Show Whitespace
You could also use another alternative. WinMerge is. It also has an option to ignore whitespace (menu Edit -> Options -> Compare -> Ignore all (under the groupbox "Whitespace" at the top)).
How to use WinMerge with TFS you can refer:
Using WinMerge with Team Foundation Server (TFS)
Using WinMerge as the default diff/merge tool in Visual Studio
2012/2013
I'm trying to have a strict no-tab policy at my company by adding blockers on commits which introduce tabs.
Problem is visual studio uses tabs for their .sln & .vcproj files even when your settings are set to use spaces instead of tabs in the VS editor.
Anyone know how I can change that or am I stuck making another microsoft exception?
For your information, spaces are supported in vcxproj but not in sln files. Replacing tabs by spaces in .sln will make it load incorrectly (not generate exceptions or anything).
There are no settings in visual studio itself to change that though.
There are scripts that can do it before submitting in a source control but keep in mind that .sln files must keep the tabs to work correctly.
This is fixed in Visual Studio 2019.
I changed some parameters in a Visual Studio C++ project, and now I don't remember how to "go back". Is it possible to reset the build settings?
I don't mean the IDE settings (menu Tools -> Import and Export Settings).
Am I the only person that can read?!
The only way I know how to reset a "Parameter in a Project's Settings",,,
Is to open the Project file(csproj, vcxproj) with a text editor, and remove the block defining that parameter.
If you wanted to reset the Allow Isolation value, you would delete this text.
<AllowIsolation>true</AllowIsolation>
When project files are loaded by visual Studio, values which are not explicitly defined in the file, are assumed to be using the default. This will only work if the property has a default value(can't change some).
NOTE: This is NOT the same as Deleting the value from the Project Properties Dialog in VS. That method writes a blank value to your project file.
The command "devenv /resetsettings" will restore Visual Studio back to its original factory state.
You can find list of devenv switches here.
You may be able to get the previous/saved version of your Visual Studio project (*.vcproj) from your software version control system.
As many wrote here before, there is a need to reset your visual studio to default settings. Just follow this: https://msdn.microsoft.com/en-us/library/ms247075(v=vs.90).aspx
Here is the awful method I used in Visual Studio 2022.
In "Property" pages, expand the individual configuration you want.
Click "All Options" and find the bold options you had changed.
To restore the defaults, click the options and select "<inherit from parent or project defaults>".
Click "Apply", then it will recover its original value.
Otherwise, you can compare the *.vcxproj with the project templates.