How do I suspend ReSharper 5.0 AND get back the default key settings in Visual Studio 2010? - visual-studio-2010

I have a project with many projects that performs miserably with ReSharper enabled, even on a pretty decent machine (8GB RAM, hybrid solid state hard drive, Core 2 Duo processor).
I was able to find out how to suspend ReSharper, but none of the default key bindings for Visual Studio (e.g. Ctrl-[comma] to navigate to type) seem to be working when I turn ReSharper off.
How do I get back the default key bindings when I disable ReSharper (and get the ReSharper bindings back when I enable ReSharper)?

Prior to resetting the keybindings in VS, export a backup copy of your current ReSharper settings:
Tools -> Options -> Environment -> Import and Export Settings -> rename file to ReSharper.vssettings -> click OK
Then repeat the previous steps but rename it back to CurrentSettings.vssettings.
Next reset the VS keybindings by:
Tools -> Options -> Environment -> Keyboard -> click the Reset button.
That should restore the settings back to the original VS default keyboard bindings and remove all of ReSharper's. (Note this also will remove any custom keybindings that you might have defined unrelated to ReSharper.)
As stated in Warren's answer you could use two VS settings files one of ReSharper and one for (non-ReSharper) default VS and import and load the one as needed.
This could be automated by creating some VS macros:
Public Sub ExportVsSettings()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-export:c:\MyVSSettings\CurrentSettings.vssettings")
End Sub
Public Sub ImportDefaultVsSettings()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-import:c:\MyVSSettings\Default.vssettings")
End Sub
Public Sub ImportResharperVsSettings()
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-import:c:\MyVSSettings\ReSharper.vssettings")
End Sub
You can then assign keyboard shortcuts to these macros for ease of use.

Tools menu -> Import and Export Settings... contains the functions you need. You can create separate settings files (.vssettings) for parts of your VS configuration, and then restore them later.
If you want to quickly switch between configurations, ensure that Visual Studio is not running, then go to the user's documents directory, then into the corresponding Visual Studio version directory, then into the Settings directory underneath that. The CurrentSettings.vssettings file is what is loaded by Visual Studio. Substitute that file with another .vssettings file containing the settings you want, and you're good to go.
These .vssettings files are regular XML files, so you could devise a clever little program to rewrite the portions of the files you want to change.

Related

Make Visual Studio use VS code shortcut keys / key bindings

I've been using VSCode a lot lately and have gotten used to the keys-shortcuts/key-bindings (Ctrl+D, Ctrl+P, Alt+leftArrow, etc). However I've recently had some work where I needed to use regular Visual Studio (Microsoft Visual Studio Enterprise 2019) and it's painful remembering two different shortcut keys.
Is there a way to import VSCode key-shortcuts to into regular Visual Studio?
I've looked at this question and there wasn't much help besides manually changing them one at a time.
UPDATE: now the above post answers the question now that I posed Francois du Plessis's answer there.
If you go to Tools -> Options -> Environment -> Keyboard. There should be an option to select Visual Studio Code as a Keyboard mapping scheme
You can create your own settings file based on an existing Visual Studio file.
Simply add your settings to it from VSCode keybinding setting file.
VSCode's keybinding settings is stored in keybindings.json json-formated file.
open file in menu
File->Preferences->Keyboard Shortcuts
or on Windows file path like that
C:\Users\<user name>\AppData\Roaming\Code\..\keybindings.json
Visual Studio's keybinding settings is stored in CurrentSettings.vssettings xml-formated file.
on VS menu:
Tools->Import and Export Settings
then select 'Import select environment setting' radiobutton and click 'Next'
you'll see browser for import your file.
on Windows file path like that
C:\Users\<user name>\Documents\Visual Studio 2019\Settings\
You can read more about it at this:
Make Visual Studio use VS code shortcut keys/key bindings

How do I restore a property sheet to its default value?

Let's say I carry out the following steps immediately after first installing and opening Microsoft Visual Studio 2010:
File -> New -> Project -> Win32 Console App -> Finish.
Go to the Property Manager pane -> Expand Debug | Win32 -> Right click Microsoft.Cpp.Win32.user -> Select Properties.
Wildly change settings in a clueless manner, and generally act like a fool.
Click Apply, save the project, and close Visual Studio.
How do I restore the Microsoft.Cpp.Win32.user property sheet to its default, "factory" settings?
I'm not sure if this is the official way, but it does work...
The default property sheets are stored in the following directory:
%USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0
And if you delete them, they will be automatically recreated by Visual Studio using the default settings next time that it is launched.
So you can simply delete Microsoft.Cpp.Win32.user.props from that directory and restart VS.
Putting it all together, from the command line, simply issue the following command:
del %USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props

Resetting a Visual Studio C++ project's settings

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.

Visual Studio: Varying tab width/options by .VCPROJ or .SLN file?

Some of our projects call for default Visual Studio tab options (width 4; keep tabs); some call for width 3; use spaces. Don't ask.
Rather than set these globally, is there anyway in which I could set this on a per-solution or per-project or even (emacs-style) per-file?
Visual Studio 2005 and 2008.
The most convenient solution I know is to create a set of Visual Studio macros to switch to the settings you want.
Go to Tools > Macros > Macros IDE. There, in the tree on the left, right-click MyMacros and choose Add > Add Module. Give the module a name such as TabSize. Within this module, create subs to change the settings you want. For instance:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module TabSize
Sub Tab3()
SetTabAndIndentation(3)
End Sub
Sub Tab4()
SetTabAndIndentation(4)
End Sub
Function SetTabAndIndentation(ByVal value As Integer)
DTE.Properties("TextEditor", "AllLanguages").Item("TabSize").Value = value
DTE.Properties("TextEditor", "AllLanguages").Item("IndentSize").Value = value
End Function
End Module
There is no useful documentation I know of for the string parameters. If you need to set other options, such as "Keep Tabs", the easiest approach is to make these changes manually (unter Tools > Options). Then, using Tools > Import and Export Settings, save these settings as a vssettings file. This creates an XML file whose structure is the same as that needed for the method calls.
Finally, you can link these macros to command buttons or keyboard shortcuts via Tools > Customize. Giving each macro a keyboard shortcut allows you to quickly toggle between settings.
I have a similar problem: my new project needs to be set up with keep tabs, while my other projects are developed with insert spaces option.
Since this is a strictly Visual Studio setting, i didn't expect to find any per-project information that will empower this (either if one use a specific add-in for that purpose).
So i ended up having eclipse-like setup: having two shortcuts to Visual Studio with different settings each.
According to MSDN, one can use /ResetSettings switch to change the Visual Studio settings upon startup. What you need now is two shortcuts with this format:
devenv.exe /ResetSettings "d:\your-settings.vssettings"
The starting time is like 5-10 seconds longer (since it applies the change settings on every startup) but it's more convenient and less cumbersome than doing it manually, every time.
HTH
You can also use these properties to complete Daniel's example :
DTE.Properties("TextEditor", "AllLanguages").Item("InsertTabs").Value
DTE.Properties("TextEditor", "AllLanguages").Item("IndentStyle").Value
I know I'm a bit late to the game:
Since Visual Studio 2017, there's support for .editorconfig files in the IDE on a per-directory basis.

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