Web.tt在VS 2013 MVC项目导致错误"价值并不在预期范围&QUOT之内; [英] Web.tt in VS 2013 MVC project causes error "value does not fall within the expected range"

查看:299
本文介绍了Web.tt在VS 2013 MVC项目导致错误"价值并不在预期范围&QUOT之内;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有其他人在VS 2013中遇到此?固定的方法吗?

Has anyone else encountered this in VS 2013? Any way of fixing?


  1. 用Visual Studio创建一个新的asp.net web应用程序2013年

  1. Create a new asp.net web application with visual studio 2013.

在添加文件夹和核心引用:检查MVC。点击OK。

Under "Add folders and core references for:", check MVC. Click OK.

打开web.config和复制内容。

Open the web.config and copy the contents.

添加一个新的文本模板到您的项目称为Web.tt

Add a new text template to your project called "Web.tt"

粘贴你的web.config的内容,改变输出扩展来的.config。你需要的是这一行(然后之后你的web.config内容):
<配置#@输出扩展=#>

Paste in the contents of your web.config and change the output extension to be .config. all you need is this line (and then your web.config contents after it): <#@ output extension=".config" #>

确认有输出延长线和粘贴的web.config文件的第一行之间没有空格。

Make sure there is no whitespace between the output extension line and the first line of your pasted web.config.

删除web.config文件(包括发行和调试版本的目标),这样web.tt就是你有web.config文件。

Delete the web.config (including release and debug build targets) so that web.tt is all you have for web.config.

在Web.tt右键单击并运行自定义工具。确保web.config文件被创建,现在你的项目的一部分。

Right click on Web.tt and run custom tool. Make sure web.config is created and now part of your project.

在控制器文件夹,右键单击,然后选择添加 - >控制器...

Right click on Controllers folder and select Add -> Controller...

选择MVC 5控制器 - 空,然后单击添加

Select MVC 5 Controller - Empty and Click Add.

命名您的控制器,然后单击添加。

Name your controller and click Add.

结果:

错误有运行选定code产生一个​​错误:'值不在预期范围内

Error There was an error running the selected code generator: ' Value does not fall within the expected range.'

推荐答案

微软回来给我,他们说这是由设计...

Microsoft got back to me and they said this is by design...

的Web.config无法删除添加的控制器,因为它是由设计。如果在web.config中修改下面的Visual Studio将崩溃。

Web.config cannot be deleted to add controller as it is by design. Visual Studio will collapse if web.config is modified underneath.

配置文件可以包含其他配置files.Web.config包括extensions.config,使刚刚产生extensions.config的extensions.tt。

Config files can include other config files.Web.config include a extensions.config and make an extensions.tt that just generates extensions.config.

参考:<一href=\"http://stackoverflow.com/questions/2411184/can-a-web-config-read-from-an-external-xml-file\">Can从外部XML文件中读取一个web.config?

征得您的同意,我走在前面,并结案。请随时免费的,如果您有任何后续问题要回我。

With your consent I am going ahead and closing the case. Please feel free to get back to me if you have any follow-up questions.

感谢您选择微软!

这篇关于Web.tt在VS 2013 MVC项目导致错误&QUOT;价值并不在预期范围&QUOT之内;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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