Visual Studio 2013 Diff Tool - visual-studio-2013

I'm used to edit files in Visual Studio 2013 Professional (update 3) using diff tool with auto-synchronize option enabled. Recently I'm not able to edit my local files anymore: they correctly appears in my Pending Changes view, but the second I compare them with my previous version (no matter if workspace or server) a small lock appears in the tab (eg: Diff - MyFile.cpp [Lock])
Any idea how to fix it?
If I try to save my file it seems a copy is saved in my temp folder with the extension - Copy

You might try updating VS2013. I have update 5 now and the diff tool seems to work reliably there.
I also found the diff tool to get somewhat flakey after a while when I was using the command line to launch it. I'm guessing that after enough bad input some prefs file would get botched and it would simply fail silently. Reinstalling the update would solve the problem, but that's a rather time-consuming process. Now that I use the VSCommands extension from Visual Studio Gallery to launch the diff tool it works reliably.
However, I'm having a similar problem as yours when I use the /m switch to do a merge of unversioned local files. A little lock icon appears on the file tab, even though I can "edit" in the GUI. However, saving doesn't save anything, and closing a dirty file just throws away the changes without even prompting! It's driving me nuts, because I can edit the same files successfully with the diff tool. Any help appreciated!

Related

Blue question mark on files in solution explorer

I often get blue question marks on files in my VS2012 Solution Explorer when opening a solution bound to Perforce through P4VS.
Looks like something is having trouble to "synchronize" with the depot/workspace/whatnot. Hitting "Refresh View" always solves the issue but I'm growing tired on doing this everyday:
This is my VS version:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
And P4VS:
2014.1.85.4506
This is persistent across P4VS versions for a few months now, and seems to be affecting sometimes individual files, sometimes entire projects, with no apparent pattern.
How can I diagnose what's going wrong, be it a server issue, a VS issue, a workspace issue?... The Perforce Source Control output shows nothing special.
Actually it's not entire folders, it's entire projects. It appears that even if refreshing a project "fixes" the issue for one run, re-opening the solution brings it back. Whereas I think that for individual files, refreshing them solves the issue once and for all. I'll play with it a bit more to confirm that.
To help diagnose what is going wrong you should probably turn on logging, and check the preferences that will show everything in the output window. For the P4VS log, go to:
Tools- > Options -> Source Control -> Perforce - Logging
(This is not the same thing as the Visual Studio Activity log.)
There could be a possibility that you are getting disconnected and refresh reconnects you. I am not sure if you have your connection set to use solution-specific settings, since you did not mention the connection dialog coming up.
This "solved" the issue for me, at least for the entire projects that went blue-question-marked:
1) Tools > Options
2) Source Control
3) Perforce - General
4) Tick the option "Treat Solution/Project as directory when
selected"
Not sure why but that's one less annoyance for me every day. Thanks to Perforce support for suggesting that.
The file is probably not marked for version control. I noticed this icon in one file and opened Perforce to check. For whatever reason, this file was not marked for add in Perforce. After marking the file for add and submitting, the blue question mark went away.

VisualHG marks files with an [R] but TortoiseHg still removes/adds the files when committing

I'm using Visual Studio 2010 with VisualHG and TortoiseHg. I've noticed that if I move or rename a file using the Solution Explorer, a little [R] appears next to the file, which I assume indicates "renamed". However, if I go to commit my changes in TortoiseHg, it doesn't perform a rename--it deletes the old file and adds the new one. This causes all the history for the file to be lost (and bloats the repo unnecessarily).
Is there any way to get this to work properly? There's really very little benefit to using VisualHG if it's not going to coordinate file renames properly with TortoiseHg.
Also, I should mention that TortoiseHg has a "Detect Copies/Renames in Solution" dialog, but I can't seem to get it working. First, I can't seem to find any button or menu item in the TortoiseHg Workbench to launch it. Second, if I launch if using the terminal by entering thg guess, no path appears in the Unrevisioned Files box (and there's no apparent way to add one). I made sure I was navigated to the correct directory (my solution directory, which contains my .hg repo) when I tried this. I also tried thg guess solution_directory_path, but that made no difference. If this dialog is a possible solution to my problem, how do you actually use it?
Edit
I finally figured out that you can access the "Detect Copies/Renames in Solution" dialog by right clicking the solution folder in Windows Explorer, and selecting TortoiseHg > Guess Renames. When I do this, however, again, no path appear in the Unrevisioned Files box, so I still can't get started with this dialog. (I.e., I can't even perform step 1 in these instructions.)
Edit 2
I found a bug report on the VisualHG CodePlex issues page that I think explains the problem I'm having: https://visualhg.codeplex.com/workitem/99. I'm kind of surprised it hasn't gotten more votes, though.
After further investigation, I realize that, even though the files were shown as removed/added in TortoiseHg Workbench, they in fact were renamed correctly.
If you click a file with a "+" next to it in the Workbench, if that file was in fact a rename, the header for the code window will show something like this:
Project/Folder/RenamedFile.cs (renamed from Project/Folder/OriginalFile.cs)
After reading a bit more about what Mercurial is really doing, it sounds like it actually is deleting and adding, it's just that the added file maintains a reference to the original, so you can still view the history across renames.
I'm not sure if this explains the problems I was having with "Detect Copies/Renames in Solution", but I'm now satisfied that renames are being handled properly.

How to solve Intellisense not working in VS 2010

I am opening files from a server ASP.net and the VB codebehind files, and my visual studio is not working correctly, Intellisense is dead and if i right click the "Go to defenition" option is disabled. These files are not part of a solution.
This is strange though because it was working properly yesterday. If I create a new project the intellisense works great, yet opening this single file it fails.
I have tried to re enable intellisense by resetting visual studio, I tried editing the text editor settings so that Auto list members and Parameter information are both checked. I even tried installing ReSharper and nothing worked. I have rebooted twice and even tried copying the file to a local drive to work on yet nothing.
Does anyone know why this is happening and what I could do to solve the problem? Im working on a rather complex problem and intellisense would make it a lot easier.
I managed to fix this problem which manifested itself after my ReSharper trial expired.
Steps to fix are:
Tools/Import and Export Settings
Reset all settings
Back up your config
Select your environment settings and finish
Intellisense started working again straight away.
For me simply hitting Ctrl+Alt+Space to re-enable Autocompletion fixed it.
I had the same problem. It only affected one of my solutions. Others seemed fine.
To correct it I deleted the solution's user options file (.suo).
When I opened the solution again, intellisense was working.
For the benefit of searchers, Nicks suggestion is good, but if you don't want to reset all your settings, you could follow the recommendation in this post.
It states - "go to "Tools | Options | Text Editor | C# | General and check the "Auto list members" and "Parameter information" checkboxes"
I should first note that upgrading my RAM from 4 to 16GB seems to have made this issue go away.
Here's the steps I go through:
If only one file/window appears to be affected, close/reopen that file. If that doesn't work, try below.
In Visual Studio:
Click Tools->Options->Text Editor->All Languages->General
Uncheck "Auto list members"
Uncheck "Parameter information"
Check "Auto list members" (yes, the one you just unchecked)
Check "Parameter information" (again, the one you just unchecked)
Click OK
If this doesn't work, here's a few more steps to try:
Close all VS documents and reopen
If still not working, close/reopen solution
If still not working, restart VS.
For C++ projects:
MSDN has a few things to try: MSDN suggestions
The corrupt .ncb file seems a likely culprit.
From MSDN:
Close the solution.
Delete the .ncb file.
Reopen the solution. (This creates a new .ncb file.)
Sometimes, it could be because of different extension style that you are using for the files.
In my case Intellisense is working in all the files except for a file in a different project of the same solution.
When I have changed the extension of the file to cxx from cpp,it started working.
The includes and other files in the solution are of extension .cxx or .txx.
Thank you
Save your solution. Closing the VS2010 instance for this solution and re-oprning worked for me.
Here I assume that Intellisense was working OK but stopped for some unknown reason without changing any default settings.
Prabhdeep
After uninstalling ReSharper, the squigglies that show up underneath a syntax error stopped showing up in the code editor.
This blog post helped me fix the issue.
Try this:
Close any open instances of visual studio, delete the folder 10.0 inside `C:\Users[username]\AppData\Roaming\Microsoft\VisualStudio\' and restart the visual studio. Issue will be fixed.
In my case, none of the above worked (although I discovered that sometimes the *.suo file is the trouble maker - in those cases deleting it helps).
I fixed it successfully the following way: Let's assume your solution has the name MySolution. Do the following:
Reset the settings (as described here). Close Visual Studio 2012.
Locate the file MySolution.sln.DotSettings (it is in the same folder as your MySolution.sln file)
Rename or delete it (for example rename it to XMySolution.sln.DotSettingsX so VS won't read it)
Open your solution by double-clicking on the MySolution.sln file
And afterwards Intellisense was working again just fine. I assume the file MySolution.sln.DotSettings got corrupted.
Note: The file MySolution.sln.DotSettings was created and checked in to TFS by a team colleague who had installed ReSharper. The issue occurred on a different PC without ReSharper where the same project was opened.
For me, this was related to an incorrect xaml file build action in an Azure WorkerRole project (bizarre, though it may seem!). Please see my entry in this post if you want to know more:
C# VS2010 Entering break mode failed
The fix for the error in the above thread also resulted in the intellisense starting to work again.
I fixed this problem by removing Sybase Power Designer VS extension.
You can try to disable other extensions.
Exactly the same issue, though would appear only on certain projects (even within a single solution).
Removing the *.*proj.user file (e.g. *.csproj.user) for the projects in question properly reset the missing features ("Go To Definition", "Organize Usings", Intellisense on certain types, etc).
In our case, I suspect this happens sometimes when we switch branches with an SCM that uses a single working directory (like git). If setup properly, it wouldn't track *.user* files but that means that if there are incompatible changes in it across different branches, you need to regenerate it.
So of course the "sometimes" would depend on the current branch and the next branch.
Unfortunately I don't see a very good solution if that's the case. Sometimes you really want to keep the user settings across branches if they're compatible, sometimes you want to regenerate them unconditionally. Ideally, you might even want to only change parts of them when switching, while keeping other parts.
If you never need to keep them and are fine with regenerating them every time, then you can configure your SCM to always remove these files while switching branches (e.g. using hooks for git). This is a pretty naive solution however, doing it more universally correctly would require a smarter system (aware of the semantics behind the .user files and capable of capturing/prompting user intent when needed).
save, close and reopen the source file you are working on. This works every time for me.
Try to add the statement:
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="IP_Updater.Default" %>
...at beginning of your page. The above example is applied for page Default.aspx written in VB.NET.
This is the problem related to Microsoft MSDN , your MSDN might be getting some problem. The solutions to this is uninstall MSDN and then re-install . before going for this make sure that you system is free from virus attack.
Hope that after doing , the Microsoft Intellisense will start running

Visual Studio opens many tabs on update from SVN

I have the problem that visual studio opens lots of tabs of code (files that I used recently), when I update my code from the SVN repository (with TurtleSVN).
The strange behavior also includes opening tabs for the same file as already in another tab, therefore sometimes there are lots of tabs that are opened twice after updating and have a :1 or :2 at the end.
After updating, it is always necessary to get rid of this chaos of open tabs and twice opened tabs.
Did anybody experience something like this?
Maybe you are having a problem updating a SUO file. Don't update a file ending with .suo. you have your own solution user option for files that you are working on.

VisualStudio.bak inside Roaming folder is extremely large. Can I delete it?

When I look at the following folders, they are exteremely large.
C:\Users\MyName\AppData\Roaming\Microsoft\VisualStudio (12GB)
C:\Users\MyName\AppData\Roaming\Microsoft\VisualStudio.bak (36GB)
What is VisualStudio.bak folder for? Can I delete VisualStudio.bak folder (since it has bak extension)?
Thanks in advance!
Answer: I found similar post here.
ReflectedSchemas folder in the user's AppData folder (Visual Studio)
http://blogs.msdn.com/b/mikhailarkhipov/archive/2004/05/14/131949.aspx
Short Answer: Yes, they are backup files created by Visual Studio for Auto Recovery.
Long Answer:
Let me explain, this is a visual studio feature to recover your solution files wherever something bad happens, and really you should keep this in mind. That auto recover can save you a lot of time when something on your system goes wrong, for example, if you laptop battery suddenly dies on you ‘seen that, done that…’
Visual studio simply creates an backup of your files with the extension .bak, you can try opening the files and see that it’s just a backup of an solution file.
But, if you keep your solution on source control you can save some time by disabling this feature, here’s how.
You need to deselect the AutoRecover setting to stop backup files if from being created:
Go to Tools->Options->Environment->AutoRecover (check that the “Show All Settings” is enabled) and just uncheck the AutoRecover option.
Tools -> Option
At this point you can clean the solution, just make a search in solution directory on your disk and delete every .bak file.
And that’s it, from now visual studio will stop creating that pesky files on your solution, but keep in mind that this is a feature to help you in case something wrong happens, but if you are connected to a source control it can save you some time and spare working in you solution.

Resources