Skip document loading when Visual Studio starts up [duplicate] - visual-studio-2010

This question already has answers here:
Document load is being skipped - what document is causing this?
(8 answers)
Closed 7 years ago.
When Visual Studio 2010 starts up it sometimes freezes when loading documents that were previously opened when I had the solution open last. I have to end the process in Task Manager and reopen it. When I reopen it, it skips document loading and says this in the Output window:
An error was encountered while opening associated documents the last
time this solution was loaded. Document load is being skipped during
this solution load in order to avoid that error.
My question is, is there an argument (or a setting) I can use when opening Visual Studio that will force document loading to be skipped? That way I won't have to open VS and wait for it to freeze before killing it and opening it again.

Tools -> Options -> Environment -> Startup
And select start page instead of opening last solution.
To prevent files opening when loading a solution (which is probably what you ask about), just delete the .user file in the projetcs directory -- this resets your local setting of which files are open on solution load.

Related

VS 2019 periodically can't save csproj files when I make a change to the files in my solution

I have a relatively new installation of VS 2019, running on a relatively new PC with Windows 11 (all about 2 months old). I also have Resharper and Web Compliler installed. All are up to date.
Within the last two weeks VS has begun having intermittent problems saving the csproj files when I add a new file to the project, or rename an existing file. It opens a file save dialog prompting me to save the csproj file, but when I click save, it then presents an alert dialog stating:
An error occurred saving the project file X.csproj
Clicking OK then returns me to the file save dialog. If I continue to click Save and then OK the alert, after a few tries, it usually saves eventually. Though sometimes it goes on so long that I abandon it.
Sometimes I can add/rename a file and it doesn't exhibit this problem at all.
I've noticed that when it's prompting me to save the csproj file, the existing file doesn't actually exist, so it doesn't appear to be a permissions issue, as the original file has seemingly disapppeared.
In addition to this, sometimes, if I try to duplicate a file in the project by clicking the file in the Solution Explorer, then hitting Ctrl+C then Ctrl+V, it gives me an empty error dialog (no error text), and the file doesn't duplicate. Again, persisting usually works eventually.
I've tried this on multiple Solutions, and I've tried suspending Resharper, but the problem remains.
I've tried repairing the VS installation, but that didn't work either.

Visual Studio IDE loading old desktop layout

I am using VS 2017 and whenever I've closed a project in the past, the same tabbed windows are automatically opened making it easy to get going where you last left off.
As of several months ago, the same old set of windows that I had opened months ago reopen each time I restart VS. This means that I must close all of the old VS windows that I no longer need and manually open the ones I do.
It's like if my IDE state is not being saved anymore. I've deleted everything in my %USERPROFILE%\AppData\Local folder but this made no difference at all. Additionally, I verified that my project files were not set to 'read only' but this did not help.
Any suggestions?
P.S. I had forgotten to mention that old and obsolete breakpoints will always be set each time you open a project.
The person who deserves credit is Sergy Vlasov for solving my problem.
There was one additional issue that I had not mentioned, one that bothered me for a few months. Some parts of my code had red error lines underneath even though my code would build fine.
The resolution to this was to simply close VS, then delete the .vs hidden folder within my project. Upon restarting VS, those lines were gone.

VS2012: Debug -> Start New Instance launches wrong project [duplicate]

This question already has answers here:
A project with output type of class library cannot be started directly - with a startup exe
(9 answers)
Closed 7 years ago.
If I right click on a project in Solution Explorer, and select Debug->Start New Instance, then the compiler kicks in getting everything ready to run. Good work so far.
However if during that compile I click within a source file that I happen to have open for editing, then the debugger attempts to launch the project that contains said source file! Usually this results in it complaining that it can't launch a class of type library.
If I sit and wait patiently for the compiler to complete before launching then all is well. But that's a bit annoying if I want to read some other code whilst it's compiling.
I'm working with C# and C++ in case that's important - you never know!
Update
The application that I want to launch is also selected as the startup project. But then that shouldn't actually matter if I specifically select the application to be started.
right click solution on solution explorer;
>> Common Properties
>>>> Startup Project
probably "Current selection" is selected . select other one of items

Error message and empty list of build definitions in VS2012 after adding favorites

We have a bunch of build definitions available through TFS, and these were visible under Team Explorer - Builds in VS until a few minutes ago, when I tried to add a couple of them to "Favourites".
All I did was right click a build definition, and select "Add to favorites", then repeat the process for another build definition:
The result however, is a now empty list of build definitions - I can't seem to find any of them again. Furthermore, I get the following error message:
An item with the same key has already been added.
Any ideas how to fix this? Anyone know where the list of "favorites" is stored? (My reasoning is that if I can find and empty that list, then perhaps this issue would disapear?)
I ran into the same issue today. I was able to resolve it with the following steps.
Close Visual Studio
Open C:\Users[username]\AppData\Local\Microsoft\Team Foundation\4.0\FavoritesStore
Move the xml file from that folder to some other location
Start Visual Studio, open team explorer and navigate to Builds
At this point, the Builds pane opened without the error and "My Favorite Build Definitions" was empty
Moved the xml file back to its original location
Refresh the builds pane.
After refreshing, my favorite build definitions were back!
You may try (this helped to me with the same issue) to delete all the files in the following folder and restart VS2012 (Source):
C:\Users[USERNAME]\AppData\Local\Microsoft\Team Foundation\4.0\Cache
This issue occurred for me today when I had a mystery dialog open and it was blocking user input. I could not locate it or bring focus to it. I had to force a shutdown of VS, and after restarting my favorites were corrupt.
I found you can delete the cache for the favorites directly and restart the IDE. As soon as it launches you will see that VS will recreate the folder, and as soon as you add your first favorite a new favorites file will be created at that location.
C:\Users\\AppData\Local\Microsoft\Team Foundation\4.0\FavoritesStore
Writing an application or clearing the adjacent Cache folder are not necessary.
Favourites are stored in metadata on the user or group. You'll need to write an app to clear them.
http://geekswithblogs.net/TarunArora/archive/2012/10/18/tfs-api-add-favorites-programmatically.aspx

Export Visual Studio Template error: "Unable to read an exported file"

When exporting a Visual Studio project to a Template (File/Export Template...) I get the following error upon clicking the Finish button:
Unable to read an exported file for the following
reason: The file cannot be opened with the selected
editor. Please choose another editor.
Screenshot http://img687.yfrog.com/img687/1756/templateerror.png
A Google search for this error has only led to several dead ends. There aren't any unusual file types in this project. Any ideas what could be going on?
By laborious trial and error (start with an empty project, add a folder, try to export template) I was able to narrow this down to a single Javascript file. As it happens, it's one of the language definitions for prettify.js (which is used on this site for code coloring). The file in question is lang-hs.js, and for some reason Windows on my machine treats this file differently from other Javascript files: It opens in Notepad, when I have the .js extension mapped to Visual Studio.
I'm not sure what the underlying explanation is, but I've already wasted enough time on this and I believe I can live without Haskell code coloring (!) so I'm just deleting this file and moving on.
It seems ".cur" files are often a culprit in this error. I have removed them from my project and now the exportation works correctly.
Microsoft staff suggest looking at log files (../windows/system32/compmgmt.msc) but this error does not spawn an entry into the Application EventLog.

Resources