“Visual Studio 版本选择器"究竟是如何工作的?选择 Visual Studio 版本? [英] How exactly does "Visual Studio Version Selector" chooses a Visual Studio version?

查看:178
本文介绍了“Visual Studio 版本选择器"究竟是如何工作的?选择 Visual Studio 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于.sln.csproj 等扩展,默认应用程序是Microsoft Visual Studio 版本选择器.我安装了两个版本,2010 SP1 和 2012 RC.此应用程序将如何决定启动哪个 VS?

For extensions like .sln or .csproj, the default application is Microsoft Visual Studio Version Selector. I've got two versions installed, 2010 SP1 and 2012 RC. How exactly will this application decide which VS to launch?

我会说它是这样工作的:

I would say that it works like this:

  1. 如果它在给定的文件中找到应该使用哪个版本的任何提示,那么它就会使用它.例如,在 .sln 文件的顶部有类似这样的内容,以便版本选择器可以决定:
  1. If it finds any hint in the given file which version should be used, then it uses it. For example, at the top of .sln files there is something like this so the Version Selector can decide:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010

  1. 如果没有找到任何提示,它将使用以后安装的任何版本(在我的情况下,我在 2012 年已经安装在我的 PC 上之后重新安装了 2010 SP1,现在我认为 VS2010 比 2012 年打开的频率更高,但我没有100% 肯定).

这是我的感觉,但确切的规则是什么?

This is my feeling but what are the exact rules?

推荐答案

文件头中有一些版本信息.否则文件浏览器将无法在 .sln 文件上显示不同的带有数字的文档图标:

There are some version info in the file header. Otherwise it would not be possible for the file explorer to display different document icon on the .sln file with a number:

代表 VS 版本 2008/2010/2012/2013/2015/2017/2019 的 .sln 文件

如果您使用记事本或其他不保留 UTF-8 签名的文本编辑器编辑 .sln 文件,图标上的这个数字就会消失(请参阅 Paul Groke 的评论).在这种情况下,版本选择器也无法选择正确的版本,您也无法从文件资源管理器中打开它.您可以专门从 Visual Studio 中打开它并保存 .sln 文件以修复它.有关此问题的更多信息,另请参阅.

This number on the icon disappears if you edit the .sln file with notepad or some other text editor that does not preserve the UTF-8 signature (see comment by Paul Groke). In this case also the version selector cannot choose the right version, and you cannot open it from the file explorer. You can specifically open it from within Visual Studio and save the .sln file to fix it. Also see this for more on this issue.

这篇关于“Visual Studio 版本选择器"究竟是如何工作的?选择 Visual Studio 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆