VSS and Visual Studio 2008 “Binary Files Differ” message for source files

白昼怎懂夜的黑 提交于 2019-12-04 12:36:39

问题


I'm using VSS 2008 and Visual Studio 2008. When my source files are checked in, the VSS property dialog shows them as type "Unicode (UTF-8)". But if I check one out from within Visual Studio, then do a compare, it says "binary files differ". Is anyone else seeing this? Do I have a screwed up setting somewhere?

Thanks, Andy

Update: Thanks to VonC for some insight. In most cases, turning off the "Auto-detect encoding of local file" checkbox fixes it, although for at least one file, it didn't help. Also I haven't been able to find a way to do multiple files -- they have to each be changed, one at a time. I'm still on the lookout for a more comprehensive solution.


回答1:


From this old (2004) but may be still relevant article:

visual source safe doesn't always recognize text file types properly. when checking-in files using 'auto' type -- it treats them as binary.

So when you compare two .sql files you might see 'binary files differ' -- and nothing more. (that's how vss treats binary files).

The solution is to change the file type using the properties context menu for the file in source safe. Change the type to text, you should be able to perform the visual comparison. You can also click on the 'advanced' option when checking-in the file, and manually change the selection to 'text' then.

To avoid in the future - you can add file type settings under the options menu in visual source safe, to set the default behavior for various file types there.




回答2:


Rather than use the built in compare tool for VSS, you can also specify other applications. That may help you avoid the binary issue. As an example, if you happen to use Beyond Compare (sadly, not freeware, but it's one I have directions for):

  1. Go to Tools menu
  2. Go to Options menu item
  3. Go to Custom Editors tab
  4. Change operation to "File Difference" selection
  5. Change file extension to: .*
  6. Change command line to (including quotes): "C:\Program Files\Beyond Compare 2\bc2.exe" %1 %2
  7. Click Add button
  8. Click OK button

I'm guessing you can swap out the command line values above with another program, but haven't tried it myself.




回答3:


Yes, other answers are correct. But what can be done if file is locked by somebody and you need to do code merge? You can't change properties once they are disabled:

To enable Type dropdown for edition do this simple trick.

0) download and run WinSpy++;

1) drag and drop pointer onto disabled dropdown;

2) change handle to 'Enabled';

3) VSS will allow you to save changes whatsoever.

ps. VSS is outdated but still widely used in lazy to change corporations.



来源:https://stackoverflow.com/questions/407571/vss-and-visual-studio-2008-binary-files-differ-message-for-source-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!