VisualStudio.bak inside Roaming folder is extremely large. Can I delete it? - visual-studio

When I look at the following folders, they are exteremely large.
C:\Users\MyName\AppData\Roaming\Microsoft\VisualStudio (12GB)
C:\Users\MyName\AppData\Roaming\Microsoft\VisualStudio.bak (36GB)
What is VisualStudio.bak folder for? Can I delete VisualStudio.bak folder (since it has bak extension)?
Thanks in advance!
Answer: I found similar post here.
ReflectedSchemas folder in the user's AppData folder (Visual Studio)
http://blogs.msdn.com/b/mikhailarkhipov/archive/2004/05/14/131949.aspx

Short Answer: Yes, they are backup files created by Visual Studio for Auto Recovery.
Long Answer:
Let me explain, this is a visual studio feature to recover your solution files wherever something bad happens, and really you should keep this in mind. That auto recover can save you a lot of time when something on your system goes wrong, for example, if you laptop battery suddenly dies on you ‘seen that, done that…’
Visual studio simply creates an backup of your files with the extension .bak, you can try opening the files and see that it’s just a backup of an solution file.
But, if you keep your solution on source control you can save some time by disabling this feature, here’s how.
You need to deselect the AutoRecover setting to stop backup files if from being created:
Go to Tools->Options->Environment->AutoRecover (check that the “Show All Settings” is enabled) and just uncheck the AutoRecover option.
Tools -> Option
At this point you can clean the solution, just make a search in solution directory on your disk and delete every .bak file.
And that’s it, from now visual studio will stop creating that pesky files on your solution, but keep in mind that this is a feature to help you in case something wrong happens, but if you are connected to a source control it can save you some time and spare working in you solution.

Related

Restore deleted files in visual studio code in the code management menu

I am really devastated because I have accidentally deleted 3 of my files in Visual Studio Code. I did it through the Source Code Management menu on the left side. Now my question... Is there any possibility to restore the 3 files I deleted like this? I would appreciate any answer and maybe you want to know: I use Windows
:-(
I tried to look into the recycle bin of windows but it isn't there. :-(
vscode maintains a file-history using its latest TIMELINE view.
How to restore deleted git-untracked files in vscode:
Create the files with the same name at the same directory.
Go to TIMELINE on the File Explorer.
You can get the older versions of the files.
No, you cannot recover those files using VS Code or standard tools. They aren't put in the recycling bin (or your operating system's equivalent), they are removed using git cleanor git reset --hard. Condolences :-(
There are of course utilities for recovering deleted files that may or may not be successful, but that is outside the scope of this question.
I accidentally removed a file that wasn't even checked in to git. Google brought me here. The file wasn't in the Trash can either (Ubuntu 18.4 VS Code 1.31.1). Looking at the git output I can see that it used git clean -f to remove it by force).
Fortunately the file was still in the editor. Just press Ctrl+P and type the file name. It should show up in the list of files and if you open it, it says "FILE_NAME (deleted from disk)" on the tab. Just copy/paste the content to where it should be.
if you accidently click the delete menu option right below rename, as long as you don't panic and like restart your computer or something you can open that directory in the file explorer on your computer
and right click.
there should be options there to undo delete or whatever else you did to the directory.
Open VSCode's command menu, and type "Local History" and select "Local History: Find Entry to Restore." Then type the name of the file you deleted.
This has worked for me when "undo" in the file tree has not.
Super easy, and has saved me from despair.

What is actually contained in a *.suo file?

I've read the MSDN Article about Solution User Options files
The solution user options file is used to store user preference settings, and is created automatically when Visual Studio saves a solution.
But what sort of settings or information is considered a "user preference setting"? I have a weird issue with one of my Solution files I've received from another company and the only fix seems to be periodically deleting the *.suo whenever the problem occurs. Can't figure out what sort of information is actually stored there though. I know it's nothing important, but I'd still like to know and I cannot seem to find the answer.
Basically the suo file(i.e., Solution User Options) contains the information related to to a user level customization like breakpoints, bookmarks, Outlining, debugger watches etc.
Also note that if you delete the suo file then Visual Studio will create a new one.
Link directly from Microsoft
In addition to what Rahul Tripathi told, suo file also stores
the list of files that are currently open in your editor so that when you relaunch solution after closing it, same files will be shown in the editor to resume our work.
the current active project in the solution, so that when you relaunch it is active again.
To understand better, delete suo file and reopen your project, all the above settings will be lost.

Visual Studio 2013 Diff Tool

I'm used to edit files in Visual Studio 2013 Professional (update 3) using diff tool with auto-synchronize option enabled. Recently I'm not able to edit my local files anymore: they correctly appears in my Pending Changes view, but the second I compare them with my previous version (no matter if workspace or server) a small lock appears in the tab (eg: Diff - MyFile.cpp [Lock])
Any idea how to fix it?
If I try to save my file it seems a copy is saved in my temp folder with the extension - Copy
You might try updating VS2013. I have update 5 now and the diff tool seems to work reliably there.
I also found the diff tool to get somewhat flakey after a while when I was using the command line to launch it. I'm guessing that after enough bad input some prefs file would get botched and it would simply fail silently. Reinstalling the update would solve the problem, but that's a rather time-consuming process. Now that I use the VSCommands extension from Visual Studio Gallery to launch the diff tool it works reliably.
However, I'm having a similar problem as yours when I use the /m switch to do a merge of unversioned local files. A little lock icon appears on the file tab, even though I can "edit" in the GUI. However, saving doesn't save anything, and closing a dirty file just throws away the changes without even prompting! It's driving me nuts, because I can edit the same files successfully with the diff tool. Any help appreciated!

How to TFS-unmap without losing physical files?

At the moment when unmapping a source on TFS Source Control in Visual Studio 2010, the local downloaded files are removed automatically.
How can I keep them untouched?
Nam.
In VS2012
"You can remove the mapping in the Manage Workspaces dialog (File -> Source Control -> Advanced -> Workspaces...) Pick your workspace and select edit, remove the entry for that mapping. Then hit OK. When prompted to perform a Get you can say "no" and the items will stay on your local disk until you next perform a Get."
I added some more information on to it.
Source: Remove Mapping
Just in case anyone else need help with this because i went for hours searching for the solution....and this is the way to see all the mappings you have and remove them if wanted without deleting local files.
I have not seen this behavior. When un-mapping, are you choosing to re-download all files in the workspace? If so, choose not to do that, and the files should be preserved locally. Keep in mind that TFS is no longer tracking changes at that point, so it could get you into a lot of difficulty if you inadvertently make changes to those files.
What kind of process are you trying to implement that you need to keep these files around after an unmap? Maybe there's a different way to accomplish what you need?
--EDIT--
When you're doing this, files are just files, so you could:
do a Get of all files in that workspace
copy them to another folder on your hard drive
map that new folder
Do an "add files" on everything in the new folder structure
check in.
You will have to rebind all of the projects/solutions to source control when you do this.

Visual Studio open files question

Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may not even need open. I have searched through the settings and cannot find anything to stop this behavior.
Simply delete the .suo file.
It contains the list of open files.
A bit of research turns up the fact that you can do it with a macro:
Create a new macro (or use an existing one). You should see a module called EnvironmentEvents in Macro Explorer. (For details, see here.)
Open the EnvironmentEvents module.
Put in this code:
Public Sub CloseDocsOnExit() Handles SolutionEvents.BeforeClosing
DTE.ExecuteCommand("Window.CloseAllDocuments")
End Sub
Save and Build the macro.
Open a whole bunch of documents in your solution, then close Visual Studio.
Yay! No more open documents!
(Note: Despite that it says SolutionEvents, it also works if you're working on a project that doesn't have a solution.)
I never realized how much that annoyed me as well! I haven't been able to find a setting, but in Options > Environment > Keyboard you can bind a shortcut to Window.CloseAllDocuments. ALT+X was unbound for me so I just used that. I'm interested if there's some hidden setting to automatically do this on solution exit though (or load).
Edit: Totally read the question wrong at first - ignore my first (now gone) answer. :)
I changed the keyboard mapping for CTRL-SHIFT-C from bringing up the Class View to closing all document windows - something I use several orders of magnitude more often - and then I just clear my workspace before closing a solution.
Try the following:
Close the program after closing all files.
Make a copy of [whatever].suo
Open the solution again, open some files, and exit.
Copy (don't move) the old .suo file over the one that was just generated.
Make the .suo file read only.
If you have a repository you might want to check that file in.
I suggest this because I was having the reverse problem, where it wasn't opening my old files automatically, and the cause was a .suo file that had been checked into the repository and was (for some reason) not being overwritten by Studio. The file wasn't even write protected.
I was hoping for something a little more automatic. VS will create a new .suo file every time the project is saved. So I would have to delete that file every time I open the project. I also don't want to have to remember to close all the files before closing VS.
Other IDEs that I have used have similar functionality, but also make it rather simple to turn on/off.
Thanks for your help.
Or you can close all open document from the Window menu before closing VS.
In Visual Studio 6.0 (VC++), the procedure is slightly different.
Delete the .ncb file (located normally in the same place as your .dsp or .dsw files).
The only way works for me is : change the project location and again reopen the solutions form there. :)

Resources