Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Git Diff CSHTML Files in Visual Studio 2015

I am using Visual Studio 2015 with ASP .Net MVC 6 on Windows 10. As far as I can tell everything's up to date, but I haven't changed anything recently that I know of. In the last couple of days Visual Studio has stopped letting me compare the current version of an *.cshtml file to see what changes I've made. It works for every other type of file I've tried, only these ones are being a problem.

I am getting the error message "Failed to start the configured compare tool." I've seen a couple of other posts (like this one: Visual Studio 2015 using Git unable to compare files and Microsoft Git Provider and Visual Studio 2012 failed to start the configured compare tool) but they seem to be talking about a more general cannot diff at all problem, which isn't what I'm seeing. It's almost as if git (or VS?) has decided to pick just this one file type to not like.

I have tried creating a new ASP .Net project with a new git repository and it sees the same problem, and the problem goes away if I rename the .cshtml file to give it a different extension. I've had a look in the .gitattributes file but can't see anything, though if I'm honest I don't really understand how git works beyond the basic 'this is how you drive it around when it works'. I've also tried removing and reinstalling everything git related I can find on my PC with no joy.

Anyone have any ideas on what I could have broken?

Update: I've just found this https://github.com/aspnet/Tooling/issues/293 which suggests that it might be related to an ASP .Net Update. Guess I'll probably have to wait and see.

like image 404
Tony Avatar asked Nov 27 '15 21:11

Tony


2 Answers

Clearing the MEF cache appears to resolve this also. Close the IDE and delete the contents of this directory:

%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache

Clear MEF Component Cache (Open VSIX Gallery) will probably do the trick as well.

Likely related to https://stackoverflow.com/a/32376450/1154135

like image 62
brahnp Avatar answered Oct 13 '22 02:10

brahnp


This turned out to be related to a problem with the new ASP .Net tooling. They've apparently got a fix to be rolled out, but until then there is a workaround:

In the options panel, go to Options->Text Editor->HTML->Advanced Set Identity Helpful Extensions to False

This is as per https://github.com/aspnet/Tooling/issues/293#issuecomment-161382206

like image 37
Tony Avatar answered Oct 13 '22 00:10

Tony