我如何知道安装了哪个版本的。net ?

我正在寻找一些像java -version一样简单的东西,我可以在命令提示符中键入,并告诉我当前安装的版本。

我最好补充一点,Visual Studio可能不会被安装——这通常是我想知道的关于客户端机器的事情。


当前回答

为了在命令行中获得已安装的版本,我建议使用net-version。

它只是一个单人间 二进制文件。 它使用了我提供的指导方针 微软 获取版本信息。 它不需要安装SDK。 或者Visual Studio命令提示符。 它不需要您使用regedit并查找注册表项 你自己。如果,您甚至可以在命令行工具中使用管道输出 你需要。

源代码可在github.com上获得

完全披露:我自己创建这个工具是出于挫折。

其他回答

如果你正在开发一些。net应用(例如web应用),你可以写一行错误代码(比如调用错误的函数名),然后重新加载页面,就会显示。net版本

MSDN详细介绍了如何从注册表中检查它:

To find .NET Framework versions by viewing the registry (.NET Framework 1-4) On the Start menu, choose Run. In the Open box, enter regedit.exe.You must have administrative credentials to run regedit.exe. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP The installed versions are listed under the NDP subkey. The version number is stored in the Version entry. For the .NET Framework 4 the Version entry is under the Client or Full subkey (under NDP), or under both subkeys. To find .NET Framework versions by viewing the registry (.NET Framework 4.5 and later) On the Start menu, choose Run. In the Open box, enter regedit.exe. You must have administrative credentials to run regedit.exe. In the Registry Editor, open the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full Note that the path to the Full subkey includes the subkey Net Framework rather than .NET Framework Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.

注意:上面快照中被剪切的最后一行在所有其他操作系统版本上为:461310。我尽我最大的努力避免在截屏时信息被剪切,但表格太大了。

它完全像java。打开终端,执行以下命令

dotnet --version

试试Scott Hanselman的. net Checker。

适用于运行Windows 10 1607并寻找。net 4.7的用户。 忽略以上所有。

不在注册表中,c:\ windows \微软NET文件夹或“已安装程序”列表或同一列表的WMIC显示。

查找“已安装的更新”KB3186568。