.net 我使用的是哪个版本的 MVC?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4930217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Which version of MVC am I using?
提问by EKet
I can't find it for some reason, feeling a little dumb. How do I know? I'm using .net 4 with VS2010.
不知为何找不到,感觉有点傻。我怎么知道?我在 VS2010 中使用 .net 4。
采纳答案by Artem Koshelev
Open web.config file and find the System.Web.Mvc assembly definition:
打开 web.config 文件并找到 System.Web.Mvc 程序集定义:
assembly="System.Web.Mvc, Version=3.0.0.0 ..."
It's an MVC3 as you see. Via web you can use MvcDiagnosticswhich is similar to phpinfo()functionality in PHP.
如您所见,它是一个 MVC3。通过网络,您可以使用MvcDiagnostics,它类似于phpinfo()PHP 中的功能。
回答by Michael Shimmins
Select the System.Web.Mvc assembly in the "References" folder in the solution explorer. Bring up the properties window (F4) and check the Version
在解决方案资源管理器的“参考”文件夹中选择 System.Web.Mvc 程序集。调出属性窗口 (F4) 并检查版本


回答by Achilles
Another solution is to search for mvc in nuget (right click on your MVC project in visual studio and select "Manage Nuget Packages").
另一种解决方案是在 nuget 中搜索 mvc(在 Visual Studio 中右键单击您的 MVC 项目并选择“管理 Nuget 包”)。
This will show you the version currently installed -
回答by DropAndTrap
typeof(Controller).Assembly.GetName().Version
Gives the current version programmatically.
以编程方式提供当前版本。
回答by Nagaraj Raveendran
I had this question because there is no MVC5 template in VS 2013. We had to select ASP.NET web application and then choose MVC from the next window.
我有这个问题是因为 VS 2013 中没有 MVC5 模板。我们必须选择 ASP.NET Web 应用程序,然后从下一个窗口中选择 MVC。
You can check in the System.Web.Mvc dll's properties like in the below image.
您可以检查 System.Web.Mvc dll 的属性,如下图所示。
回答by Balaji KJ
I chose System.web.MVC from reference folder and right clicked on it to go property window where I could see version of MVC. This solution works for me. Thanks
我从参考文件夹中选择了 System.web.MVC 并右键单击它以转到我可以看到 MVC 版本的属性窗口。这个解决方案对我有用。谢谢
回答by Vinco
Well just use MvcDiagnostics.aspxIt shows lots information about current MVC instalations, and also helps with debuging. You can find it in MVC source or just Google for it.
那么只需使用MvcDiagnostics.aspx它显示了有关当前 MVC 安装的大量信息,并且还有助于调试。您可以在 MVC 源代码中找到它,也可以在 Google 上找到它。
回答by Abhishek Duppati
In Solution Explorer open packages.config and find Microsoft.AspNet.MVC:
在解决方案资源管理器中打开 packages.config 并找到 Microsoft.AspNet.MVC:
package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net461"
包 id="Microsoft.AspNet.Mvc" 版本="5.2.3" targetFramework="net461"
From the above we can see it's an Asp.Net MVC 5.2.3 Version.
从上面我们可以看到它是一个 Asp.Net MVC 5.2.3 版本。
Moreover packages.config file also helps us to track all the installed packages with their respective versions.
此外,packages.config 文件还可以帮助我们跟踪所有已安装的软件包及其各自的版本。
回答by Shwe
Navigate to "C:\Program Files (x86)\Microsoft ASP.NET" folder. You will see "ASP.NET MVC 4" or something like that. To know detail navigate to "C:\Program Files (x86)\Microsoft ASP.NET{your MVC version}\Assemblies\System.Web.Mvc.dll" Right click and see the version.
导航到“C:\Program Files (x86)\Microsoft ASP.NET”文件夹。你会看到“ASP.NET MVC 4”或类似的东西。要了解详细信息,请导航到“C:\Program Files (x86)\Microsoft ASP.NET{your MVC version}\Assemblies\System.Web.Mvc.dll”右键单击并查看版本。

