Fast variable renaming in Visual Studio - visual-studio

I remember I used to rename in some old Visual Studio (VS) version just directly editing the item and hitting enter to confirm.
The newer version of VS requires the user to first "inform" that he wants to rename something ([CTRL+. or F2], VisualStudio: Shortcut for when Renaming Variable). Is there a way one can disable this requirement and go back to the "old days" behavior?

Related

Ghostdoc 'document this' shortcut not working

I'm using Visual Studio 2017 Community Edition V15.8.4 and the latest Ghostdoc version available in the Marketplace (Build 2018.1.18330).
Since the last update, Ghostdoc no longer recognizes any assigned shortcut. Whenever any shortcut other than Ctrl+Shift+D is assigned, on 'document this' Ghostdoc says 'Ghostdoc noticed that you don't have a shortcut associated with Document This. Do you want to re-assign the Ctrl+Shift+D shortcut?'.
It doesn't matter how the shortcut is assigned (Tools => Options => Keyboard or Ghostdoc re-assign shortcut). The error also pops up if I use the menu rather than the shortcut to document something.
The shortcuts tried are not used anywhere else, and I also get the error if I assign one of the shortcuts suggested by Ghostdoc.
If I uninstall Ghostdoc for VS 2017, there still remains Ghostdoc Community which has no option to uninstall. Disabling it makes no difference and trying to document something only using this edition, it always says 'action cannot be performed, VS still loading the project', even after the project is clearly fully loaded.
If I assign a shortcut and cancel the '...re-assign the Ctrl+Shift+D shortcut?' popup, commenting with the new shortcut actually works.
Does anyone know why this might be happening and how it can be fixed. If not, is it possible to manually add the shortcut somewhere, e.g. the settings file?
Serge B. here, I'm with SubMain (the GhostDoc company).
From what you are describing you may have the MSI version of GhostDoc installed. Please uninstall it in Progmas and Features.
This KB article describes different symptom but the solution is the same - https://support.submain.com/kb/a53/troubleshooting-vsix-installation-issues.aspx
My advice is to uninstall both MSI (Programs and Files) and VSIX (VS Extensions and Updates), then install the latest GhostDoc Community we recently released. It includes a fix with the shortcut assignment which may be related to the issue you are experiencing.
Thanks!

Visual Studio files association in Windows

In Windows Explorer when I double-click on any Visual Studio file (*.cs, *.csproj, etc.), it's opening an old version of VS instead of the latest one (VS 2017). And VS has associations with too many file types.
How can I change the default Visual Studio (for all those files that VS can handle)?
There is a similar old question about Visual Studio 2008 (Move file associations from Visual Studio 2005 to 2008) but the solution in there doesn't work anymore (there is no "Restore File Associations" button on the settings of Visual Studio 2017).
Each version of Visual Studio registers itself in the Set Default Programs panel of the Control Panel.
Go to Control Panel\Programs\Default Programs
Then choose Set Default Programs:
In there you can simply choose the Visual studio version of your choice and then click the button Set this program as default in order to associate every file type that VS handles.
Or you might prefer to click the button Choose defaults for this program to review the current associations of those file types and change only the ones you want.
Yet another in a long list of previously working-just-fine things which Microsoft have managed totally #$#%# up. If I try to change defaults the 'right' way I get this kind of thing:
i.e. completely ignored. The only way I've managed to solve it is by removing the file association entirely through the registry. Let's take .asm as an example:
Open Registry Editor / "regedit.exe"
Navigate to HKEY_CLASSES_ROOT\.asm\OpenWithProgIds
Delete any Visual Studio values you see
From there, you can (finally) open files with whatever you choose instead of having the association clamped to Visual Studio:
For the record, I believe this to be a problem with Windows 10. Not with Visual Studio. See: https://answers.microsoft.com/en-us/windows/forum/windows_10-files/cant-change-default-programs-in-windows-10/229fc3a9-25c9-433b-a333-5806bc5090db
On the file you will always open with vs17, click right and choose open with and there choose another app. On win10 it pop out a dialog with some proposals. If vs17 is there, choose your favorite and activate the always open with. then ok and your done.

Assign .vcproj files to Visual Studio 2008, when Visual Studio 2010 installed

I have encountered a strange error. I use Windows 7 x64. Visual Studio 2010 (VS10) and Visual Studio 2008 (VS08) are both installed. Now i want to make sure that when i doubleclick open a .vcproj file it is being opened by VS8 and not VS10. Now this seems like a trivial problem, but:
"righclick -> open with -> choose default program -> select devenv.exe of VS08 -> always open with" doesnt work. In fact after browsing for devenv.exe of VS08 it does not show up in the list/menue where it is supposed to be displayed.
This is very strange and annoying, maybe someone already encountered this error and know a solution.
I GOT IT! For the Express versions at least. I strongly suspect these instructions can be modified to apply to the full version. The names will change of course.
I spent a lot more time on this than I will ever save by being able to click through to the correct IDE, but darn it, I just hate to give up.
Here's the deal. Strangely, the associations seem to be keyed to the program file names. (Say, what?? That sure is the way it looks to me.) Both VC++ Express 2008 and 2010 are named VCExpress.exe. We'll give the 2008 version an alias. We'll also use a doppelganger to pull off something of a ruse.
Navigate to "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE". Make a copy of VCExpress.exe, (not a shortcut), and re-name it VCExpress-2008.exe. (It would probably do just to re-name the original and use the new name in step 3.)
Open regedit.exe. Create a new key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\VSExpress-2008.exe
Edit the (default) value in that key, to hold the string "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe" [sic]
Go through the drill with the file-association dialog again. Right-click, open with, choose default program, yada, yada, yada. Browse your way down to C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE and click on VSExpress-2008.exe.
VCExpress-2008 now shows up as a program in good standing, with its icon proudly displayed on the front page above the fold. (Don't tell the dialog, but you and I know it really points to VCExpress.exe, not the copy we made.) Click it.
Celebrate.
Ok i finally found a way. You can use the application "default programs editor" to mess with the standard file associations.

VSLauncher starts wrong version

I have 3 versions of Visual Studio installed, and 3 projects that require a specific version. VSLauncher USED to look at the SLN or VCPROJ file and open the correct version of Visual Studio. Now it only starts the most recent version, regardless of the project.
Note that this has nothing to do with the commonly reported problem with beta versions of VS. none of the SLNs have ever been touched by a beta VS.
I had this same issue. VS 2008 solutions opening in VS2010 when double clicked. This problem went away after first going into VS 2008 and using 'Restore File Associations' then right clicking on a 2008 solution file and choosing open with and pointing it to Version Selector. Prior to this they invariably opened in 2010. Very frustrating. Hope this helps.
Tools | Options | Environment | (big button marked Restore File Associations
The problem was that the SLN files were subtly corrupted. Deleting the files and letting the appropriate version of VS recreate them resulted in a file that the diff tool thought was identical, but was exactly 3 bytes longer. I suspect the problem can be traced to a missing UTF-8 Byte Order Mark. Why VSLauncher is that picky is another question.
ADD: Yes, After opening the new file in a hex editor, I can say for certain that the problem was a missing BOM on the old file. This was tricky to spot because my diff tool apparently does not even see the BOM.
I also found, in Windows 7 Explorer, that I could right-click the sln, select Open with / Choose default program, then select Microsoft Visual Studio Version Selector - it would open with VS2008 (as was appropriate) and from then on, double-clicking the sln file would cause VS2008 to launch.
I had the same problem.
Visual studio could open normally the solution, but the version selector couldn't identify the version correctly.
In my case there was a problem with the EOL. Somehow the file was using unix EOL format, by changing it back to Windows format, the version selector started working again.
For Windows 10 and Visual Studios 2017 and 2019:
Click Windows Start Button
Start Typing 'Default app settings'
Choose "Default app settings'
Near the bottom of the page, click the link "Choose default apps by file type"
Find the extension ".sln" or ".vcproj", and select the default application.
Open your solution in the right Visual Studio version. Click your Solution to select it. Click File --> Save xxx.sln.

How do you clear your MRU list in Visual Studio?

I want to clear the list of projects on the start page...how do I do this? I know I can track it down in the registry, but is there an approved route to go?
There is an MSDN article here which suggests that you just move the projects to a new directory.
However, as you mentioned, the list of projects is kept in the registry under this key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\ProjectMRUList
and the list of recent files is kept in this key:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<version>\FILEMRUList
Note For Visual Studio 2015:
The location has changed. You can check out this answer for details.
Some people have automated clearing this registry key with their own tools:
Visual Studio Most Recent Files Utility
Add-in for cleaning Visual Studio 2008 MRU Projects list
PowerCommands for Visual Studio 2008
Features
Clear Recent File List
Clear Recent Project List
Clear All Panes
Copy Path
Email CodeSnippet
Insert Guid Attribute
Show All Files
Undo Close
Collapse Projects
Copy Class
Paste Class
Copy References
Paste References
Copy As Project Reference
Edit Project File
Open Containing Folder
Open Command Prompt
Unload Projects
Reload Projects
Remove and Sort Usings
Extract Constant
Transform Templates
Close All
If you try opening up a project that can no longer be found, Visual Studio will prompt you for permission to remove it from the MRU list. So if you temporarily rename an appropriate top level folder to fake the projects' disappearance, you can get rid of the projects one by one.
In Visual Studio 2015 all the history lists (including search history, file MRU and project MRU) are now located at:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\MRUItems
You will see a different GUID folder for each list, and a sub-folder called Items in each of them. Find the Items folder that contains the relevant list, and just delete its parent GUID folder.
Visual Studio will re-create the GUID folder together with a new Items child folder, next time it wants to add something to the list again.
I found the MRU editor from Code Project a great tool for that. No problems with it, and it works on 2003, 2005, and 2008.
Note: This answer is specific to Visual Studio 2010.
If you don't want to manually edit the registry, you can use PowerCommands for Visual Studio 2010.
PowerCommands 10.0 is a set of useful extensions for the Visual Studio
2010 adding additional functionality to various areas of the IDE.
The specific command for clearing the registry from the extension is:
Clear Recent Project List This command clears the Visual Studio recent project list. The Clear Recent Project List command brings up a
Clear File dialog which allows any or all recent projects to be
selected.
The PowerCommands can be installed with the Visual Studio extension manager: Tools > Extension Manager > Online Gallery: search for PowerCommands for Visual Studio 2010.
Try Recently Used Files: a free addin for Visual Studio that manages MRU files on a per-project basis:
Supported for VS 2010, 2012, 2013.
For Visual Studio 2012, 2013:
http://visualstudiogallery.msdn.microsoft.com/a61cbd1d-b5a2-490b-a6bb-f0ea3ecf214a
For Visual Studio 2010:
http://visualstudiogallery.msdn.microsoft.com/45283881-5a62-4dc1-8ffb-4cbc02709947
For Visual Studio 2013:
Open the Run dialog (Press Win + R)
type: regedit
navigate to: HKEY_CURRENT_USER > Software > Microsoft > VisualStudio
click 12.0 then the files will show up on the right side.
Look for the "LastLoadedSolution", right click then click Modify
change the value to 0.
This worked for me.
I'm not sure if this solution has been posted somewhere here, but if you have VS 2013 Update 5 you can open start page, and right click project below "Recent" list, and choose "Remove from list". I don't know how about other VS versions, maybe this feature is available.
I had this issue as applied to VS 2017 where you do not have any MRU items in the registry as in the previous versions. The solution was, on the other hand, simple: go to "Tools->Extensions and Updates" and install "Power Commands for Visual Studio". After they have been installed, your File menu will look as shown below.
Just click the menu item to clear the project MRU.

Resources