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".
Related
The compare tool in Visual Source Safe (pre TFS) had a handy checkbox to select "Ignore White Space".
Now we are using TFS with Visual Studio 2010, and the compare dialog no longer has this option. (A ridiculous oversight from Microsoft!)
So, is it possible somehow to work around this?
This is a workaround that seems to get around the problem.
In Visual Studio, select Tools / Options / Source Control / Visual Studio Team Foundation System and click the Configure User Tools button.
In the dialog, Add an item with the following settings.
Extension : .*
Operation : Compare
Command : C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
Arguments : %1 %2 %6 %7 %5 /ignorespace
Edit:
Depending on your Visual Studio version and instalation path (x64/x86), the command option may be...
VS2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
VS2012: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\diffmerge.exe
VS2013: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsDiffMerge.exe
VS2015: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsDiffMerge.exe
VS2017: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe
In the argument option leave it with the same number of arguments as the VS suggests and just add /ignorespace in the end. For example, in the VS2015 it will be:
%1 %2 /ignorespace
There is a "=" button on Visual Studio 2017 toolbar that helps to compare files as you want. Hope this screenshot will help.
The default diff tool in Visual Studio is extremely annoying. I suggest you use an alternative.
WinMerge is my favourite. It also has an option to ignore whitespace (menu Edit -> Options -> Compare -> Ignore all (under the groupbox "Whitespace" at the top)).
See Using WinMerge with TFS.
In VS2015 it's possible to "ignore white space" when comparing clicking a little icon with the = symbol.
Go to "View/Toolbars/Compare Files". In the toolbar click on "Ignore trim whitespace".
Update 2020: we struggled a lot solving conflicts with VS comparison tool and the Tortoise SVN one, so after a research we decided to install Devart Code Compare (free version) which has integration with VS2015/2017/2019, SVN (Tortoise and Ankh), TFS, Mercurial, GIT, etc. and Windows Explorer, so no more nightmares/confusion between different comparisons tools. Give it a try, it's extremely useful. It has also Merge to solve conflicts and Folder diff, which is really useful when SVN does not merge for some reason. Also, clicking on the left/right arrows to copy the changes is a feature that I really like.
Below VS image is from Devart website, but in my case I setup Code Compare to open it outside VS instead of embedded, I think it behaves better. And in VS Options > Source Control > Subversion Environment, I have this:
The default diff tool in VS 2013 does let you ignore whitespace after all. Just run the standard differencing process. When Visual Studio brings up the differences, look on the toolbar, where you will see an icon that looks like a document with 5 dots under it, as shown below. This button toggles whether the displayed differences ignore white space. This worked well enough for me; I wanted it to ignore changes in the white space caused by indentation.
in VS 2012, this might be what you're looking for with no changes to Diff tool.
Opening up the compare screen in VS 2012 and at the top you see the following option in the toolbar. as it might be the same comparison as user: Master screenshot.
I read the this Tool for comparing files in Visual Studio post and the recomended posts but unfortuantely it is only for VS-2008. I am wondering if there is a working tool for comparing selected files in visual studio 2010.
Ideally, select 2 files in Solution Explorer and right click and choose "Compare Selected Files"
I also have ankhSVN as my subversion program therefore cannot use
Edit: I have successfully selected WinMerge as my tool for Diff process, but how do i actually compare 2 files using it?
AnkhSVN is the same for VS2005, 2008 and 2010. You can use Tools -> Options -> Source Control -> Subversion User Tools to configure your diff/merge and patch tools. It will auto-detect most tools, so you only have to select them from the dropdown menu.
See also ankhsvntips
EDIT: There's currently no option to diff 2 different files, you can only diff versions of the same file.
I use BeyondCompare, its really good.
http://www.scootersoftware.com/support.php?c=kb_vcs.php
SourceGear DiffMerge is great, and integrates well with VS2010 and AnkhSvn. It's recommended in the AnkhSvn wiki.
To compare 2 files just choose "Open File Diff..." from the "File" menu.
VS IDE config instructions for WinMerge are available from Paul Bouwer's blog entry Replace diff/merge tool in Visual Studio Team System with WinMerge:
In Visual Studio under Tools > Options > Source Control > Visual Studio Team Foundation > Configure User Tools, add entries for Compare and Merge using the options indicated.
Works great anywhere in VS IDE that the Compare command is available eg in Pending Changes and Changeset Details windows.
Also works great with Windows Explorer integration and as a stand alone tool.
Resharper has some commands I just can't live without (keybindings are given for the Visual Studio template):
Open by filename (Ctrl+Shift+T)
Locate in solution explorer (alt-shift-T, useful only when solution explorer is configured not to track the current file already)
Does visual studio have alternatives to these that don't require Resharper? I know VS2010 adds the "Edit.NavigateTo" command (Ctrl+,) but it is slow and shows every useless symbol that might be what you want (too noisy).
Is anything similar offered by other perhaps free addons?
You might want to try the Solution Navigator feature that is bundled with the free Visual Studio Productivity Power Tools extension. It appears to have more powerful support for searching for files and symbols all combined within the Solution Explorer.
My website has several nested folders and sometimes long file names, so sometimes only 4 tabs can be opened at a time.
Can vs2010 be made to show only file names and leave out any path information?
Can the max displayed length for tabs be set?
I know the window can be split so top and bottom both have their own tabs.
For example (using the "Visual Studio 2010 Pro Power Tools"):
Showing the files:
...r.aspx.cs
...s.aspx.cs
...s.aspx.cs
...s.aspx.cs
...s.aspx.cs
For example (not using the Visual Studio 2010 Pro Power Tools):
Showing the files:
Adminstration/...quests.aspx.cs
Adminstration/...tUsers.aspx.cs
Adminstration/...ctions.aspx.cs
Adminstration/...eBanks.aspx.cs
Try installing the "Visual Studio 2010 Pro Power Tools" extension from the Extension Manager in VS. It adds a new section to the standard option dialogue that allows you to customise what they call the "Document Tab Well."
It doesn't let you truncate the filename, but you can change the way they draw and scroll, which might be enough to help.
It does allow more tabs at a time, but it severly shortens the amount of file name you see. So while it allows editing more files, you won't know what file you are editing.
For now I'm using the trial version of Tab Studio
In VS2010, go to Tools - Extension Manager. Go to the online gallery and search for this extension:
Visual Studio 2010 Pro Power Tools
This extension, once installed, gives you extensive control over the document well, including setting a max tab width and much more. I love this extension, and have had zero issues customizing tab behavior to suit my preferences. Hope this helps.
Fixed in Visual Studio 2012
This has finally been fixed in Visual Studio 2012:
So i see:
PendingRequests.aspx (rather than ...r.aspx.cs)
ImportUsers.aspx.cs (rather than ...s.aspx.cs)
SearchTransactions.aspx.cs (rather than ...ctions.aspx.cs)
ImportTimeBanks.aspx.cs (rather than eBanks.aspx.cs)
Now if we could just get the entire Visual Studio ecosystem to:
return to the use of Left, Right arrows to navigate overflow tabs
open new tabs on the right
just like Windows has been doing in 1994, and Visual Studio would start to almost become a user-friendly Windows application.
I have been using this excellent extension for VS2010 that solve your problems: Visual Studio 2010 Pro Power Tools.
It is a bundle of several extensions, but the most notable for you is the Document Well 2010 Plus. It allows you to configure the document tabs: to be the constant width, colour-coded by project, pinned, etc...
You can toggle the extensions that you do not want by editing the manifest file in:
~\Local Settings\Application Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\Visual Studio 2010 Pro Power Tools\
#IanBoyd: I agree, it doesn't solve the problem 100% however it helps (which is why most of the answers to this question suggest it). With the Visual Studio 2010 Pro Power Tools add-on you can a) set the maximum tab width using one tab options, b) setup some colour categorizing rules to help differentiate between projects/file types.
In VS2010, my workflow relies upon several add-ons and keyboard shortcuts to manage my workspace; for example I use CTRL + Tab to switch between active documents, use the pin-tab feature and colour coding from Power Pro Tools, the open solution file dialog from Visual Assist X, and re-open last edited file from Resharper.
This has been answered already here:
Remove path from tab name in Visual Studio 2010
Install the productivity power tools extension and it should do it by default!
Cheers.
I would like to use WinMerge as the default diff tool inside VS2008 from the solutions explorer in place of the "Compare..." context menu item. Is this possible? I'm looking for a quick replacement of the current bland diff tool an I just like WinMerge better. I'm not interested in going to the folder explorer and doing the comparison there.
I'm using Visual Source Safe 6.0 not TFS
Yep, it's possible!
See this link: http://whyiamright.wordpress.com/2008/01/18/changing-the-diffmerge-program-used-by-visual-studio/
Tools-> Options. In the tree, choose Source Control, then the plugin of your choice (VS team Foundation, Source Safe, etc).
Click the "Configure User Tools" button, click add, then specify the appropriate extension, operation, EXE, and arguments list.
This site: has the settings for many, including winmerge: http://blogs.msdn.com/jmanning/articles/535573.aspx
EDIT:
You mentioned VSS: Check out the Winmerge manual here: http://winmerge.org/docs/manual/VersionControl.html. It says how to do it about 1/5th the way down the page.
I think I have this working at a serviceable level if not optimal.
in visual studio go to tools > options > source control > plug-in settings
click the "advanced" button
in the sourcesafe options dialog, switch to the "custom editors" tab
for operation, select file difference
for file extension enter .*
for command line enter
"C:\Program Files\WinMerge\WinMergeU.exe" /x /e /ub /wl /dl %6 /dr %7 %1 %2
click the "add" button then the "ok" button.
using "compare" from a file's context menu or viewing history and selecting "diff" should bring up winmerge with the file comparison. the original is on the left and the modified file is on the right (is that the right placement? should they be swapped?). if you selected a highlighted difference, you can actually sync that area at this time as well. visual studio will just recognize the file has changed and ask you to reload. I haven't gotten to the situation where I'm in an actual "merge" situation so I'm not sure what happens there. I'll update this post if I ever have more info to add.
I'm using VS2008, sourcesafe 2005, and winmerge 2.12.4 installed to the default directory. I copied the settings from this post: http://weblogs.asp.net/garrypilkington/archive/2009/12/16/winmerge-as-a-comparison-tool-in-visual-studio-2008.aspx
I have been wondering about this as well and have not found anything to make it possible in VSS 6.0.
For now, it looks like the answer to our question is "No".
As I stated previously, I don't think we can integrate WinMerge with Visual Studio 2008 and VSS 6.0.
However, I did find that VSS 2005 is backward compatible with VSS 6.0 databases. So, if your server can't change from VSS 6.0, at least perhaps you can change your client to VSS 2005, and then follow the other instructions from the answers here.