Why don't tabs open automatically when I reopen my solution? - visual-studio-2012

I have an ASP.NET MVC4 application solution (.sln). When I close Visual Studio and then reopen it and my solution, my tabs and my navigation structure in the solution explorer do not restore to the way they were.
The solution is big and it takes me a long time to reopen many tabs and open lots of folders in the solution explorer.
Is there an option in VS that would allow me to restore the solution to where it was when I left it?
I've already done "Reset all settings" in the Import and Export Settings Wizard, but it didn't help.
I've also tried booting VS in /SafeMode which disables any extensions. No difference.
Searching around I can't see anyone have similar issues.

As far as I know the .suo-File saves which files are opened. Try to delete this file (VS will generate it new) and make sure that windows-file-permissions are set correct (read, write access).

I had the same problem with Visual Studio 2013, and I solved it by doing this:
Export my current settings, making sure to UNMARK General Settings > Window Layouts.
Re-import the settings I just exported, but making sure I left General Settings > Window Layouts MARKED now (so it would overwrite the current Window Layouts with the "clean slate" of the imported settings.

Perhaps you can try the Workspace Reloader plugin that Scott Hanselman blogged about?
http://www.hanselman.com/blog/IntroducingWorkspaceReloaderAVisualStudioAddInToSaveYourOpenFilesAcrossProjectReloads.aspx
You can install it from here - http://visualstudiogallery.msdn.microsoft.com/6705affd-ca37-4445-9693-f3d680c92f38

Got this issue also for Microsoft Visual Studio 2022 Community Edition.
How to fix :
First, be sure, that tools->Project and solutions->General:'Reopen documents on solution load' and 'Restore Solution Explorer project hierarchy state on solution load' enabled
Second, just close VS and delete .vs folder, then re-start VS.
Works fine for me

Related

Visual Studio crashing when trying to diff or compare files

I'm using TFS for source control and the other day I undocked my laptop while running VS. I couldn't connect to the internet and then unfortunately there was an unexpected shutdown. Since then I have not been able to go into pending changes and compare the file to it's previous version. When I do, it crashes Visual Studio.
I can change the user tool in Options > Source Control > Visual Studio Team Foundation Server to use a third party diff checker and it works no problem. However, I've gotten used to Visual Studio's diff checker and would like to continue using it, if only because it doesn't open a separate window to diff in.
Since I'm not sure as to the source of the problem, my question is two-fold:
First, how do I fix Visual Studio's diff checker and stop it from crashing every time I try to compare with previous version.
Or, if the issue lies with TFS, why is it crashing and how do I fix it?
Click on Visual Studio Menu:
TOOLS > Options
Then on Left Panel:
Text Editor > HTML > Advanced
And finally on Right Panel:
Extension Management > Identify Helpful Extensions
Change this setting to false.
This is an old question, but I needed to fix this recently, so the bug still exists!
I solved this problem by going to Tools -> Options -> Source control -> Plug-in Selection and changing the plug-in to "Git"
Try to disable ability to Identify Helpful Extensions:
Go to Tools->Options->Text Editor->Html->Advanced->Extension Management->Identify Helpful Extensions and switch to false.
You can start VS in safe mode with "/SafeMode" param.

Visual Studio regularly freezes running Microsoft.VisualStudio.Web.Host.exe

Background
I maintain several web sites that are Visual Studio "Web Site Projects".
Problem
I've found that with a couple of these projects, Visual Studio regularly freezes while I'm working on the code. This doesn't happen for some of the web site projects, and I haven't seen it happen on any Web Application projects.
Symptoms
Each time it freezes, it takes about half a minute before I can use it again.
During a freeze, Windows Task Manager reports that Microsoft.VisualStudio.Web.Host.exe is maxing out one of the CPU cores.
Steps to Reproduce
Open a .cs file under the App_Code directory.
Make a change to the file.
Save the file.
Navigate somewhere else (eg switch tab, close the file, open different program in Windows).
Navigate back to the file (eg switch tab to it, open it, or go back to Visual Studio).
Other actions that sometimes seem to trigger the problem:
"Go to definition"
Opening a file
Previewing a file
Closing a file
Using a refactoring
"Find usages"
What I've Tried
Both Visual Studio 2012 and Visual Studio 2015
Changing the website project's build action
Disabling "Build Web site as part of solution"
Deleting web references and the Bin folder seems to minimise the problem, but obviously this breaks the web site. Maybe web site projects experience this problem when they contain a lot of C# code other than code-behind files?
Similar problems
I found the following potentially-related problems using Google, but none of them seemed to contain a workaround or solution.
Microsoft.VisualStudio.Web.Host.exe Time Theft
Microsoft.VisualStudio.Web.Host.exe
Visual Studio 2012 freezes for approximately 30 seconds after every build
I noticed that the problem happened less often when I suspended ReSharper.
The problem still happened occasionally when editing classes under App_Code, but restarting Visual Studio worked around it.
I was facing a similar problem. A single Web application project with dozens of class libraries, migrated over from VS 2010 into VS 2013.
I was able to solve my problem by disabling the "Hosting Process" option:
To disable the hosting process
Open an executable project in Visual Studio. Projects that do not
produce executables (for example, class library or service projects)
do not have this option.
On the Project menu, click Properties.
Click the Debug tab.
Clear the Enable the Visual Studio hosting process check box.
Full details on MSDN: http://msdn.microsoft.com/en-us/library/ms185330.aspx
Another option for people experiencing this on old web applications that don't have the properties page in the accepted answer above.
Disable "Allow this precompiled site to be updatable".
Open Site/Solution
Right click and view Property Pages
Go to MSBuild Options
Uncheck "Allow this precompiled site to be updatable"
This worked for me.
This problem stopped happening when the Web Site project was converted into a Web Application project.
Not an easy solution, but it did stop the problem.
They symptoms in the question of this post sound exactly like the nightmares I just had today:
Other actions that sometimes seem to trigger the problem:
"Go to definition"
Opening a file
Previewing a file
Closing a file
Using a refactoring "Find usages"
Plus intellisense wasn't working (even with CTRL + J) and
'Peek definition' was hanging as well.
I had to keep task killing visual studio (both 2015 and 2017).
My fix was to go into the project that I was having problems with, open the 'Package Manager Console' and uninstall and re-install the 'DotNetCompilerPlatform'
uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
and then
install-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
So far every problem I was encountering has not resurfaced (but this was just today so still need to give it time).
UPDATE:
It started creeping back again. I noticed also that whomever had installed to the solution had only done it to two of the various projects. Uninstalling the compiler platform (which means using the compilers that came with Visual Studio) has made life sane again.

Pressing Ctrl + S automatically opens Output window

Whenever i press Ctrl+S from keyboard or whenever i click on any file in Solution Explorer it automatically opens output window only in Visual Studio 2012.
I tried
Tools > Options > Projects and Solutions > Show output window when build starts
I am using Visual Studio Professional 2012
But its just not working. Its irritates a lot. Please suggest how to get rid of it.
if someone is facing this issue in visual studio community 2015, in my case the issue was caused because of the use of Backup and sync utility from google, I have synced my source directory to my google drive to maintain the latest copy of source backed up.
The backup utility locks the file which you might be editing for syncing it to cloud storage. since the file is locked by another process, the visual studio cannot save the changes in the file.
The fix was to pause the syncing for the time you are doing frequent changes.
In your case, it might be some other process which might be locking the file.
If you're using an extension, one of them could be the reason.
I had the same problem while saving the CMakeLists.txt files. I checked one of the extension's setting, "CMake Tools", it has a "Cmake: Reveal Log" settings which causing this problem. I simply deactivated it
I suggest you to check extensions' settings or try to find on settings with searching "output", "focus" etc.

Azure, edit in visual studio online option - gone missing

I have two azurewebsites, in the azure management portal looking at the 'dashboard' both sites had a 'edit in visual online PREVIEW' option. This option has now disappeared on one of the sites - any possible reasons?. I have tried logout, close browser, clear cache etc..
Have you already opened it in Visual Studio? If so, just open Visual Studio and the solution will be listed under the Recent section of the start page. If it's not there, click the Recent Projects and Solutions option in the FILE menu. As for why it disappeared, hard to say. I just started using Visual Studio Online (aka TFS) and have found that while very convenient and easy... things are a little weird sometimes. Good luck!
Doh! - The switch to enable it on the config pane was off. - Thanks

How do I add folders into the Solution Explorer for Visual Studio Express 2012 for Web?

I am very new to Visual studio, so I am trying to learn the basics.
I have read so many articles but some are for 2012, some are for the non-web version, etc, but I seriously can't find a solution to such a simple task as this.
I am using Visual Studio Express 2012 for Web, and have created a "Blank Solution".
I end up with this view:
Now my goal is to add all my existing files and folders and have it shown in Visual Studio.
So, I have located my solution file on disk and copied all my files into the same folder:
Now, I know its possible to add single items into the view by right clicking and picking add item:
But I cant include folders here. I have tried to drag and drop, I have read guides about using the "Show all files" button, but apparently that does not exist for the Web version of Visual Studio 2012.
Could anyone please tell me what the proper way is to include all my files into the solution explorer?
I just had this same problem in Visual Studio 2012 Ultimate. I know your question is about Web but maybe this will work for you too.
Assuming the files/folders you want to include are in your solution folder, from the Project menu toggle on "Show All Files", then you should see the files/folders in Solution Explorer. Select those you want to include, right click and choose "Include in Project".
A solution contains one or several projects and no solution-wide files (normally). Create a project, and then follow How do I add an existing directory tree to a project in Visual Studio? to add the files.
(It was a long time ago I did it this way, and with an earlier version of Visual Studio, so YMMV.)
I think that the best way to do it is to simply drag&drop desired folders with files between file explorer and solution explorer in VS. I've just tested it and that works the best for me.
You can place your files in the Solution folder and refresh the solution explorer :) It'll automatically add your files, I do it for 2010 and think it'll work for 2012 as well
In solution Explorer top toggle,You can find few icons, Find Show all files and click on it.Navigate to the folder exactly matching the same address in your visual studio and you can see a folder which is newly added into your project,Which is displayed as a dotted folder and right click on it and include it into project.
Don't forget to convert the project into Web-Application.
Thanks.
I actually found the solution.
So in solution explorer there is a button "Solutions and Folders" screenshot
When you pressed it your project folder would be opened. You find the folder that you need to add, copy it (screenshot), return to project solution and past it

Resources