asp.net-mvc 网页:版本设置有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6405341/
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
What does the webpages:Version setting do?
提问by Generic Error
When creating a new project using the ASP.Net MVC 3 tools it adds the following application setting to the Web.config:
使用 ASP.Net MVC 3 工具创建新项目时,它会将以下应用程序设置添加到 Web.config:
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
</appSettings>
What does it do?
它有什么作用?
采纳答案by Darin Dimitrov
This was recently introduced in ASP.NET MVC 3 projects (after installing the ASP.NET MVC 3 Tools Update). I guess it is in preparation for handling upcoming WebPages releases (Razor) in ASP.NET MVC 4 where you will be able to choose the version of the razor view engine with your application. Currently it doesn't do much.
这是最近在 ASP.NET MVC 3 项目中引入的(在安装ASP.NET MVC 3 Tools Update 之后)。我猜它是为在 ASP.NET MVC 4 中处理即将发布的 WebPages 版本(Razor)做准备,您可以在其中选择带有应用程序的 razor 视图引擎的版本。目前它没有做太多。
回答by Anujith
From the MSDN Blog,
来自MSDN 博客,
It determines which version of Razor engine to use when editing razor webpage files.
它决定了在编辑 razor 网页文件时使用哪个版本的 Razor 引擎。
In VS2013 Preview, we released new Razor V3 runtime and design time Engine to support MVC5 and Razor V3 website's runtime and design time behavior. Unlike Razor V2 runtime and design time, VS2013 did not GAC these binaries. Instead, the binaries are installed in the project bin folder when corresponding NuGet package is installed, and in “%ProgramFiles (x86)%\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions \Microsoft\Web\Razor\v3.0” to support design time.`
If the key is missing from web.config file such as default Razor V2/V3 website, VS will use bin directory's razor dll version to determine the design time razor engine dll to load.
Updated 10/9/2013: In VS2013 RC and RTW, VS will open the single webpage file using the highest Razor version on the box if a single webpage file (i.e. cshtml or vbhtml files) is opened without bin directory nor web.config setting.
在 VS2013 Preview 中,我们发布了新的 Razor V3 运行时和设计时引擎,以支持 MVC5 和 Razor V3 网站的运行时和设计时行为。与 Razor V2 运行时和设计时不同,VS2013 没有对这些二进制文件进行 GAC。而是在安装相应的 NuGet 包时将二进制文件安装在项目 bin 文件夹中,并在“%ProgramFiles (x86)%\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\Web\Razor\v3.0”中支持设计时间。`
如果 web.config 文件中缺少密钥,例如默认 Razor V2/V3 网站,VS 将使用 bin 目录的 razor dll 版本来确定要加载的设计时 razor 引擎 dll。
2013 年 10 月 9 日更新:在 VS2013 RC 和 RTW 中,如果打开单个网页文件(即 cshtml 或 vbhtml 文件)而没有 bin 目录和 web.config 设置,VS 将使用盒子上最高的 Razor 版本打开单个网页文件.
回答by Luká? Lánsky
It is being usedto distinguish between the second and the third version of Razor engine.
它用于区分 Razor 引擎的第二个和第三个版本。