How to avoid automatically unfolding of projects in Visual Studio 2010 Solution Explorer - visual-studio-2010

I have all the projects in a solution folded, so you can't see their files in the Solution Explorer. And a file belonging to one of those projects open. Once I browse to that file pane, the project containing the file is automatically unfolded in the Solution Explorer.
Is there a way to avoid that automatic unfolding?

I'm not 100% sure what you're after, but in the VS 2010 options, under "Projects and Solutions/General" there is an option called "Track Active Item in Solution Explorer".
I've just tried unchecking that and, with a mutiple project solution all collapsed, when clicking into an open code file it doesn't open up the project in the solution window. Try that and see if it produces the result you're after.
Let me know if I've misunderstood your question though!

Related

How can I extend the environment tabs in Visual Studio 2013?

How do you extend Tabs in Visual Studio 2013? It would be handy to extend the Tabs so that you can selectively track an item in Solution Explorer by right clicking on a tab.
By default, Visual Studio will track active items in Solution Explorer via the setting: Tools > Options > Projects and Solutions > General > Track Active Item in Solution Explorer.
Having that turned on makes Solution Explorer jump around, and is consequently confusing on large projects, so I turn it off. But, what I'd like to be able to do, is right click on an open tab, and select a menu item to make Solution Explorer track and display that file's location in Solution Explorer. Basically it would be on-demand selective file tracking.
I know hovering over the tab, you can see the file path and locate it that way. What I would like is a quicker shortcut to displaying the file location in Solution Explorer.
If there is a plugin that already does this, please let me know and provide a link. Otherwise, I'd be interested in knowing how to do this myself. Thanks.
There is a button on the Solution Explorer toolbar Sync with Active Document and the corresponding command SolutionExplorer.SyncWithActiveDocument for keyboard binding.

VS 2010 - Adding additional projects to Solution

At work we have just upgraded from VS2008 to VS2010 (keeping up with the times, I know). In VS2008 I used to navigate to various project folders in Source Control Explorer and double click the vbproj file and it would add it to my current Solution (or create a new solution if there wasn't one). The functionality in VS2010 seems to be that when I do this it closes my current Solution and opens the new project on its own.
Is there any way to get the VS2008 functionality back? I know I can right click on my Solution and Add->Existing Project..., but that takes a lot longer. I've tried Googling this but have come up blank.
Thanks in advance.
No, this beaviour was taken out from VS between 2008 and 2010. In 2010 when you double-click a *.csproj or *.vbproj file it will always open it up in a "temporary solution".
This gets annoying when comparing diffs between local changes to your project file... in my view VS should open it in the editor if anything. /rant

Code Window does not highlight selected (usually .cs) file in "Solution Explorer"

My Visual Studio has done something really weird.
Usually, when you are in the "edit window" and are changing code, the file you are editing will highlight in "Solution Explorer".
Also, if all projects are "collapsed" in "Solution Explorer", and then there is a file already open (as in, you can see its "tab"), when you click the tab of that file (to be able to edit it), the Solution-Explorer will un-collaspse that project and highlight the file you are editing.
My "Solution-Explorer-Highlight-The-Current-File" function has stopped working.
I can move from tab to tab to tab, and Solution-Explorer doesn't react at all.
I've googled and binged, and I either get 5 billions hits ... or none. The key phrases are too ambiguous I think.
Anybody ever seen this one?
I have VS2010 on the same machine, and it works just fine.
I have one Add-In installed, but it is installed in both VS2010 and VS2012. Thus I don't think it's the culprit.
Smaller hammer.
From the menu: Tools -> Options
From the tree: Projects and Solutions -> General
On the form check: Track Active Item in Solution Explorer
Well.
From here:
How do I truly reset every setting in Visual Studio 2012?
I found this "Big Hammer" command line switch.
/ResetUserData
I used it.
And now it works.
I hate to answer something myself, but just in case somebody hits this in the future.

Doubling file names in Visual Studio 2012

In Visual Studio 2012 in Solution Explorer window have doubled file names (sorry for no screenshots - here is the link http://floomby.ru/s1/uaxC8K).
In the same time it's all right in File Explorer and in project file (http://floomby.ru/s1/WaxCv8).
It's really annoying thing and cant find the reason why is this happening. What can be done to prevent such behavior?
Still can't describe how to prevent, except it's just use the Visual Studio 2012 merge tool more accuratly. But here is the solution to get rid of duplicate entries in Solution window.
First remember somehow all name of duplicated files (PrtScr or smth else)
Unload the project (call context menu on project name, item "Unload Project")
Edit "ProjectName.xxproj" (call context menu on project name, item "Edit Project.xxproj")
Ctrl+F, paste the name of duplicated file, choose Find All. Look in Find Results window for absolutely identical entries of project files and remove one of them (https://docs.google.com/file/d/0B0NKNNSBiGejeV8wZ3g0WEYzcTA/edit?usp=sharing).
Save changes and Reload Project
Another way is that
Exclude duplicate files from project
Click on "Show all files" button on top of solution explorer
Click again on "Show all files" button on top of solution explorer (this time you should see only one excluded file)
Include file again
You can do this on folders too

VS2010 "Add Item" directory change

Is there any way to change the default directory Visual Studio 2010 uses when you add a source file through Add -> New Item?
Add New Item simply adds the item based on which project directory you're currently in or have selected in your Solution Explorer. If you want to change where it gets added then select the target location in the Solution Explorer first.
This behavior is obvious when right-clicking in the Solution Explorer, but it's also the same when using Project -> Add New Item....
Since my comment seems to be the actual answer, I repost:
In the toolbar of Solution Explorer, there's a button "Show all files" (or similar, I'm using the German version). This switches the view to directories, rather than filters. In this view, you can right-click on the desired target folder to add items.
This does not actually change the default directory, but since you have to click somewhere anyway to add an item, this is the easiest approach.
Note that even when only using Visual C++, I'd recommend the Productivity Power Tools extension, which comes with Solution Navigator. In C++, this is not as powerful as with .NET, but it still has several features that are useful in C++ and can fully replace Solution Explorer.
Try going to tools -> options -> Project and Solutions.
I know this post is old... but maybe someone will stumble upon it... like I did today...
I had the same "problem":
I have a dedicated directory for icons.
When I need to add an icon to the resource file, Visual studio takes me to "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
To fix the problem, after I "browsed" to the desired folder, I right-clicked the favorites of the "open file" dialog and selected "add current location to Favorites".
Next time you will get this dialog, you simply have to look for the folder in the favorites, and click it.

Resources