How to tell VS2012 C# debugger where to find sources - visual-studio-2012

I'm trying to debug a third-party library. I have it's .pdb and sources. I put .pdb near my dlls. When I step-into third-party code for the first time, VS2012 asks where are the sources. I pick the correct file and everything is fine. Now, I'm rebuilding my code with another version of the same third-party lib. I have another version's .pdb and sources. When I step-into, it doesn't ask where are the sources, instead, it just connects to the SAME SOURCES it connected at the first place. I can close the file and open file from new sources, but each time I press F11 to step-into another file, it continues to open files from the old location.

Visual Studio remembered the selection you made and stored it in the hidden .suo file in the solution directory. You can edit it. First ensure that the Solution Explorer window displays the solution name (similar to "Solution 'name' (x projects)"). If not then use Tools + Options, Projects and Solutions, tick the "Always show solution" checkbox.
Right-click the solution in the Solution Explorer window, Properties, Debug Source Files setting. You should see the directory you added in the original debug sessions. Delete it and add the new directory.

Related

Cannot add Sublime project preferences after opening repo via Github Desktop

I have been happy to notice that Github Desktop lets me open a repo in Sublime Text. It seems to open the repo as a project but I have a hard time figuring out how to edit the project preferences for the repo. Specifically, I would like to add file_exclude_patterns.
I have tried Project > Save Project As... in Sublime, but then when I open the repo through Github Desktop it opens two Sublime windows: one that respects my project preferences and one that ignores them.
From your problem description, it sounds like you might be running into issues with the hot_exit setting. When that setting is turned on (which is the default), then whenever you quit Sublime, it saves the state of all open windows into a session file before it quits.
That session file contains a list of every window that's open, what files are open in each, their scroll position, selection, any unsaved changes to files, and so on. When you restart Sublime, it loads the session file and restores its state back to what it was previously, seamlessly putting you back to where you were before.
One of the potentially unintended side effects of this is that the session is always restored every time you start Sublime. So if you have a project open in a window, and you quit, Sublime keeps a record that you had one window containing that project. If you start it and tell it to open the same project, it will first restore the session and then open the project, resulting in two windows.
As such, turning off hot_exit may solve this problem for you. When it's off, the session information isn't saved, and Sublime starts in a more or less "fresh" state every time. The downside to this is that you will be prompted to save all unsaved files, your list of open files is lost, etc. Depending on your use case, this may or may not be an issue.
If you already have that setting off and this still happens, then the issue would be that GitHub for Windows is opening both the project and the folder, which would result in two windows. In that case there's not a lot to do but poke the people in charge of GitHub for Windows and tell them to fix their code.
On the other hand, if you turn off hot_exit and you get one window, but it doesn't respect your project preferences, then the problem is that GitHub for Windows is only opening the folder, not the sublime-project file.
In that case, there's not a whole lot to be done, unfortunately. Sublime won't load a sublime-project file just because it happens to be contained in a folder, since there can conceivably be many of them in there (many people keep their project files in a single folder, for example).
If Sublime is associated with sublime-project files, then opening the sublime-project file would result in Sublime opening the project for you, so that may be a possibility as well.
Beyond that, you're more or less in the realm of things like using Project > Switch Project or Project > Quick Switch Project to get the window to display what you want; that's not very handy with regards to just opening the project, though.

Move solution in Source Control

I have a project under source control in Visual Studio 2012 using TFS2010. When I added this project, the solution was not added in the correct file folder location. I want to move the solution, but every time I try to do it within the Source Control Explorer I encounter an error: "The project file 'path/to/project.csproj' has been moved, renamed, or is not on your computer." What is causing this error? What is the proper way to move the solution to where I want it to be?
Move the solution file in TFS (this is more relevant if you have history you want to maintain)
Open the solution, it will complain that it can't load your projects, either edit the path to the project in the properties window, or remove each project and then re-add it. Check-in your changes
Delete the .suo file and try once. Has helped me in the past. This file is usually hidden. Restart VS after deleting.
The problem is the solution file has relative paths to the project files. I usually do any moving around when I first create the solution (before there are projects in it). However, in your case I would just use Source Control Explorer to move the solution, then edit the .sln file in a text editor and fix up the relative paths to the proj files.

Visual Studio 2012- How do you delete a new file?

I have Visual Studio 2012 with TFS. I created a new file (call it "x.h") and before I checked it in I decided I didn't need it.
MSDN makes it sound so simple:
In either Solution Explorer or Source Control Explorer, browse to the folder or file that you want to delete.
Select the items that you want to delete, open their shortcut menu, and choose Delete.
When you are ready, check in your changes.
So I went to Source Control Explorer, right-clicked the file, and chose Delete. It was removed from source control and my pending changes but is still on disk and in the Solution Explorer. When I right-click the file in Solution Explorer, Delete is not an option and Exclude From Project is disabled.
I might have more luck if I check it in first then delete it but that seems very unnecessary. Hopefully I'm just missing something obvious!
How do I delete this new file ("x.h") from my solution?
Yep. It was something obvious.
You can't delete files from the Solution while it is building.
I just tried again and the Delete option magically reappeared. I realized that it has stopped a build since I last tried.
In short, there are three different angles that a user can try to delete a file while a build is occurring and the behavior is different for each.
Undo the file add from Pending Changes -> Nice error messages are given.
Delete the file from Source Control Explorer -> It lets you remove the file as I described in the question but leaves it on disk and in Solution Explorer (same behavior regardless of whether or not a build happening).
Delete the file from Solution Explorer -> It quietly prevents you from shooting yourself in the foot and doesn't explain why.
The right way to do this is to cancel the build (or let it complete), then delete from Source Control AND from Solution Explorer.

TFS 2012 build definition: Parameter Items to Build: cannot convert value Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings

After a lot of editing of my build templates (I recreated them in 2012 to avoid any issues.. but then I suppose I got sloppy and simply copy/pasted whole blocks from the old workflow, and I suppose that must have completely destroyed my versioning) I now have problems with just one build definition based on the build template I edited. (All other ones seem to be working fine.. so I suppose that one got a problem during all the editing. (I was mostly adding and removing Version=11.0.0.0 to the assemblies in the build template))
The exact error is:
Parameter Items to Build: cannot convert value
'Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings' of
type Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings
to type
Microsoft.TeamFoundation.Build.Workflow.Activities.Buildsettings,
reset to default.
It is displayed when editing the build definition and wanting to select the project/solution and configuration to build. Actually, with this now I cannot save (without error) any more and the value gets deleted again.
(I am using VS 2012 (VS 2010 still installed) against TFS 2012.)
How to fix?
Open up your XAML and look at the xmlns's on the Activity root node:
Here's a snipped version of mine:
<Activity mc:Ignorable="sads sap sap2010" <!--Removed-->
xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common"
xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client"
xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow"
xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow"
xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow"
xmlns:mttbb="clr-namespace:Microsoft.TeamFoundation.TestImpact.BuildIntegration.BuildActivities;assembly=Microsoft.TeamFoundation.TestImpact.BuildIntegration"
xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client"
xmlns:mtvc1="clr-namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common"
Look for Version Specific references (usually "10.0" or "11.0") and remove them so they look like the ones I have above.
Also, check you project references and ensure that they are not Version Specific.
Here is HOW to change the assemblies in your TFS Template:
In Source Control Explorer, browse to the BuildprocessTemplates and
open (double-click or choose "View" from the Right Click menu) the
template that your build is based on (the one giving you the above
error)
You should see a visual diagram of the workflow. At the bottom are
three tabs: Variables, Arguments, and Imports. Click on Arguments.
Select the BuildSettings Argument
Find the Properties box. The properties for an arguement are:
ArgumentType, Direction,IsRequired, Name, and Value.
Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings
should be the selected Type but the problem is (typical) you can't
tell which version of this assembly is selected. Click the drop
down.
At the bottom of the list choose "Browse for Types..."
NOW you can see all of the available assemblies and their versions. Choose the one you want, most likely upgrade to the latest. Be sure to go through all of the various arguements and make sure their types are all are set to the same version to ensure compatibility.
You may encounter issues now saving the file. All may appear to be ok. TFS indicates it knows the file has changed, checkin seems to go smoothly, but when the file is opened the assemblies still reflect v 10. If you open the same file from the file system you may find that the assemblies in the file really are v 11. What give? No idea. Some sort of glitch in VS.
But here is a work around:
Uninstall VS 2010 Team Foundation Server Power Tools from your
development machine
Open VS 2012 and make sure the template has no pending changes (undo) and get latest version
CHECK OUT FOR EDIT (important) but do not make any changes in VS (it
won't open anyway since the 10 assemblies were uninstalled in a
previous step)
Close VS 2012 (important because if it is open it will appear that your change didn't take)
Open the template from the file system (I used notepad to eliminate any interference from VS) and perform a find/replace on "Version=10.0.0.0" with "Version=11.0.0.0" and save the file
open VS 2012 and now you should be able to see the workflow designer
Of course, check in the file

How to open the actual file from changeset details in Visual Studio 2012, and not some hashed read-only server copy?

This is the first time I've tried this in a VS, much less VS 2012, so if the answer is common knowledge, I guess I'm just not that common. (Yeap, Google failed me as well --- or my Google-fu just needs some oiling.)
I'm looking through my TFS code repo history, and from the list of changesets, I opt to view changeset details. Up on the VS 2012 right sidebar, I get a list of all changed files for this particular changeset.
However, I want to open up one of these files and modify them directly (basically for purposes of light code review and housekeeping), so I right-click on one, and select Open.
Unfortunately, this doesn't open up my local copy of the file, but instead (seemingly) downloads the file from the server and gives me the server copy, with a modified filename (suffixed with a short hash). I can't modify this at all.
Is there a way to open my local file copy from the changeset details?
What you could do is right click the file.
Then choose open in source control explorer.
Double click the file there.
Bob should be your uncle now.
If you right click and compare it to your workspace version, that will open a diff between the workspace version and the changeset version. I don't believe there is a way to open the local version of the changeset file directly, as that version doesn't really exist in your local workspace. What you are opening when you open it from the changeset is the specific version associated with that changeset. The file may not even exist in the current solution, so opening the workspace version in same cases wouldn't even be feasible (or you may have never gotten the file).
To the best of my knowledge there is no good way to do this (I wish there was). It's a bit time consuming, but you can get the same effect with a bit of manual effort:
Open the changeset, rollback changes, go to pending changes, and open all of the files. After the last file has opened, go back to pending changes and undo changes (i.e. your rollback). All of the files from that changeset should now be current and open in visual studio.

Resources