Visual Studio Diff Tool - When is Editing Allowed? - visual-studio

I'm using Visual Studio 2013 and tfs 2013. Sometimes I'll make a code change and click compare with latest version. The diff tool will open and allows me to edit the file in the diff tool. However other times it will not let me edit but will read only.
Is there some setting or something I need to do for me always allow edit?
In a database project I've noticed that it never lets me edit in the diff tool. Is there some setting I need to change?
I've searched around online but haven't found any answers to this.
Thank you.

Editing in the Diff viewer is only allowed for certain file types. It doesn't support editing .sql files and there is no VS setting to allow that.
Visual Studio Diff Window: How to Edit .sql Files

Have you tried other diff tools like WinMerge or Beyond Compare?
In Visual Studio, go
Tools-->Options-->Visual Studio Team Foundation Server-->Configure User Tools,
add the extensions of the file types you would like to compare and under Command,
input the path of the diff tool (in my case it is Beyond Compare)

Other answers are correct as well but do not cover all the cases.
Visual studio will not allow you to edit file during compare if the panel you are trying to edit does not correspond directly to the file in your working directory.
You can easily tell by the address bar on top of the compare panel. If it ends with HEAD or Index - you will not be able to edit the file.

Related

Is there any way to open the regular editor for a code file from the diff view in Visual Studio?

If I double click a file in Pending Changes, I get the diff view, which is nice, but sometimes I want to edit the file instead. Is there any way to bring up the regular editor from the diff view or from Pending Changes? What I've been doing is searching for the file in Solution Explorer, but that's kind of slow and I was hoping there was a way to bring up the editor directly from the diff view or from Pending Changes.
The difference viewer built into Visual Studio provides a basic read only file view; so the answer is no ... not for out of the box Visual Studio tool. But not external applications.
I recommend that you use a purpose built diff viewer and specify it to be used by visual studio that will launch into the external program.
I personally have been using Araxis Merge which allows one to view/edit the local copy. It then allows you to save to the local file during a difference view.

Export Visual Studio's 'Code Style settings' as .editorconfig

Our team works with Visual Studio 2017 Professional.
I've been trying to unify the Code Style across the team and apparently the industry standard right now is to use .editorconfig files. Even Visual Studio in it's settings windows suggests to use that configuration file and links to a useful page on how to write an editorconfig file.
but I don't want to write all the settings that I already have configured in VS by hand. I would like a tool that exports those settings as a .editorconfig file to distribute them.
I haven't been able to find any tool to do just that so I thought on righting it myself and share it with other people like me. But apparently if go to "Tools -> Import and Export Settings..." you can't download your current Code Style settings.
Is there a way around this?
do you know any tool to convert my settings to an editorconfig file or a way to export my current Code Style settings?
Edit
I have created my own version of the .editorconfig file based on the information found in here
You can find it in my github repo
I realise this isn't much help for VS2017 users, but VS2019 has a button "Generate .editorconfig file from settings" on the Code Style options page:
This options page is available at Tools > Options > Text Editor > [C# or Basic] > Code Style > General.
I know this question is ancient but worth an answer...
The latest Visual Studio extension allows you to do this (Guide here):
Basically install the extension and right click on the solution or project (you can restrict the rules to solution/project or even folder) and click add > new EditorConfig (IntelliCode)
There are still some restrictions about what you can do in the latest releases of Visual Studio, but Visual Studio 2017 15.8 Preview 3 or higher allow you to use a new extended “Format Document” command to perform additional code cleanup for the current document.
It's a shame you can't make all your rules cause build errors, only some of the options allow this - without this, a lot of the styling options can be ignored.

how to compare two files in visual studio ignoring casing

I want to compare two files in visual studio (files containing stored procs)
So I want to ignore all the "Capital" / "Small" differences in the file.
I opened the command window and used Tools.DiffFiles but its taking the case difference also into consideration
P.S I have already seen this question and answers for it
Although Visual Studio is asked for explicitly, I recommend a different tool: WinMerge.
It indeed has many options for comparing and merging files. It lacks a 3-way-merge though. Of course WinMerge can optionally ignore case.
Visual Studio can be configured so you can call WinMerge using "Tools / External Tools ...". Then you may even install a toolbar item for it. Quite nice!
Most version control systems allow you to use WinMerge as a compare tool. For example for TFS you open the "Tools / Options ..." menu and there you choose "Source Control / Visual Studio Team Foundation Server". Click on the button "Configure User Tools".

How can you see the difference between two files in Visual Web Developer 2010?

I've seen some SVN tools that use a "diff" command that will highlight the differences between two files. However, I don't understand how to do this within Visual Web developer 2010 (Express). Any help discovering this method will be greatly appreciated.
Thank you,
PS: I include visual-studio-2010 in the tags as I think it is the closest thing to web developer 2010.
I am not sure if VWD has its own file compare function, but you could use WinDiff from the Windows SDK. Here is the link for version 7.1 - http://www.microsoft.com/en-us/download/details.aspx?id=8279
Taken from http://msdn.microsoft.com/en-us/library/bb385990.aspx
To compare two files
On the View menu, click Other Windows, and then click Source Control Explorer.
In Source Control Explorer, right-click the version of the file that you want to
compare, and then click Compare.
NoteNote
As an option, you can right-click a file in Solution Explorer and then click Compare.
The Compare dialog box appears and the local path of the file that you selected is
in the Source Path box.
Enter the Target Path or click Browse and locate the target folder.
Under Target Version, select the Type you want to use for comparison: Changeset,
Date, Label, Latest Version, or Workspace Version.
Click OK.
If the files have no differences, the Microsoft Visual Studio dialog box appears,
informing you that the files are identical. Click OK.
Otherwise, a difference window displays the files side by side.
I use devart's code compare tool and it worked really good for me. You can download it from here.
http://www.devart.com/codecompare/

Hidding source control files within Visual Studio's solution tree

We use Visual Studio 2008 and Surround SCM for source control. SCM drops files into each directory named ".MySCMServerInfo" which are user specific data files that shouldn't be checked into source control. They are similar to the .scc files dropped by Visual Source Safe. We also have several WAPs (Web Application Projects) that we develop. All these .MySCMServerInfo files show up in the solution tree and the Pending Checkins window when they should not. There has to be some way to force VS to ignore files of a given extension because it ignores .scc files. How do I get VS to ignore .MySCMServerInfo files within a WAP?
I have new information about this issue. Setting the hidden bit on .MySCMServerInfo file causes Surround SCM to loose track of the modification state for files. It starts thinking files are out-of-date when they are not, and it always attemps to get new versions.
Instead, set this registry key if you're using Visual Studio 2008:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\
{8FF02D1A-C177-4ac8-A62F-88FC6EA65F57}\IgnorableFiles\.MySCMServerInfo]
Set this registry key if you're using Visual Studio 2005:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\
{8FF02D1A-C177-4ac8-A62F-88FC6EA65F57}\IgnorableFiles\.MySCMServerInfo]
These will tell Visual Studio to not display .MySCMServerInfo files within the Solution tree and the Pending Checkins view.
Using the file system hidden bit should work.
Late Answer but hopefully useful to others.
I began experiencing this problem when using Visual Studio 2015 with the new ASP.Net 5 Project templates. (I presume this is because the new templates automatically include everything in the folder rather than only showing the things that are listed in the project file).
Showing these files in the Solution explorer change be prevented by right clicking the file and selecting "Hide from Solution Explorer" but this didn't prevent SCM from including them in the Pending Check-ins Window.
The correct way to deal with this problem is:
Select the file(s) in Solution Explorer
Select the File > Source Control > Exclude from Source Control
Reference
NOTE: Right Click in the Solution Explorer DOESN'T have this option.

Resources