Undo Pending Changes Visual Studio 2012 and TFS - visual-studio-2012

I recently switch from Visual Studio 2010 to Visual Studio 2012 and it seems that "Undo Pending Changes" may be broken in the Visual Studio Version 11.0.50727.1 RTMREL. I'm using TFS 2010. When I try to undo changes I get the error "There are no changes to undo in the selection or any children of the selection" and I can't revert back to my original code.
Has anyone else observed this problem or know of a work-around?
The exact steps are:
Add a new file to your project. TextFile1.txt for example, but it can be any type of file.
Check in the file to TFS
Check out the file and add one additional line of code.
Save and verify that TFS is aware of the differences by doing a compare.
Select the file in solution explorer and right-click and select Source Control / Undo Pending Changes...
You will see the message "Warning. There are no changes to undo in the selection or any children of the selection." OK/HELP. Pressing OK does not revert the file to it's previous state. (HELP doesn't help).

I had this problem. I fixed it by making a backup of my file. Then by doing a Get Latest, Undo Check out and then checked-out and put my changes back.

Related

Android Studio duplicate Version Control

I am creating a new project with Blank Activity in Android Studio.
Then VCS > Enable Version Control Integration > Git > OK.
After that I am closing the project and immediately I am opening it.
I am opening Setting > Version Control and it turns out that settings duplicate.
If I close and open the project again, one more backup line appears. And the quantity of such duplicating lines increases with every start.
Please, could you explain me, if it is normal or I do something wrong? Thanks a lot for you response.
http://hsto.org/files/806/992/9a6/8069929a60724887b55805b4fd6868e9.png

Undo checkin in TFS using visual studio 2012: rollback will not give me my pending changes back

I accidentally pressed the Checkin button when I had a list of all my pending changes (in several solutions) open (and I had disabled the confirmation prompt a few years ago, have restored it now though).
I know I can do a rollback of the specific changeset, but this will not give me back my checked out items as it will just overwrite the changes of the changeset with new changes.
Does anybody know of a way to undo the checkin and get my checked out items and changes back?
Perhaps there is an extension to do a rollback, keep al the changes locally and check out those files again.
Or there is another automated way to keep al the changes and check out the files (manually checking out each file is to much work).
Edit
There doesn't seem to be a perfect way. For me the best solution was to 'Rollback the rollback'as stated in https://stackoverflow.com/a/24896432/1343595

Disable auto save of code in Visual Studio 2012

I am using Microsoft Visual Studio 2012 Pro for windows software development. Earlier I used to use VS 2008.
One option that I couldn't find (which was there in older version) is :
Before building -
-Do not save any changes
-Save all changes
-Prompt to save changes
The above was available in Tools->Options->Build & Run in older versions.
At times when I make temp changes in my code which I don't want to save it then that feature comes in handy.
Is there any way I can stop VS 2012 from saving my code before I build/run it.
Thank you,
Cheers,
GR
That feature was dropped in Visual Studio 2010. As far as I know it hasn't resurfaced in Visual Studio 2012.
Save All Files Before Build Gone in Visual Studio 2012?
The IDE prompts for saving on unsaved code or resources when you close the project.
With GIT or other source control you can run on command to save versions.
I actually like the program "Second Copy" which you can set up to save versions of your code (I save the last 15 versions of any changed file in the project). This is set up to run whenever a file changes, but you would not want it to save a new version every time you make a change while testing/debugging, preferring to only back up to the new version every time the file is SAVED either manually using the mouse/Shortcut keys or upon close of the IDE. That way you have true backup of code you are satisfied with.
I think having autosave is dangerous because it overworks the source control if you have one in place (either GIT or Second Copy or whatever) and if you don't you lose the ability to go back to a prior version should you stuff up the code or decide not to proceed with changes. Having the option, though, to have autosave (either at intervals or on "Run"/"Build") should still be there to please all users (but the default should be "off")
Of course on "Publish" all files are saved anyway (as they should be).
Give "Second Copy" consideration...http://www.secondcopy.com/ (I have no association with second copy, I have just used it for years and love it)

How to force Visual Studio not to add GlobalSection(Performance) section?

I played with Visual Studio builtin profiling tools and now every time I check out any file this section automatically adds to my solution file:
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
I totally removed all profiling reports, then removed local copy of all source control files from this solution and update to latest. This section still in *.sln file after any checkout.
Other teammates who haven't used prfiler doesn't have this problem.
Has anyone any ideas?
Open the PerformanceExplorer in Visual Studio by using the Menu Analyze -> Windows -> PerformanceExplorer and check if it lists any session entries.
If so delete them by doing a right-click on an entry to open the ContextMenu. Then select "Remove" from the menu.
You should also check the folder of your solution if it contains any .vsp or .psess files and delete them. These are the report files of a profiling session.
Only way I could solve this was to close the solution, delete *.psess and *.vsp files from the root directory, reset my .sln file to the remote version and reopen the solution. Problem was then gone. This was using Visual Studio 2015 Community Edition.

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