【问题标题】:Exception when adding a View to MVC3将视图添加到 MVC3 时出现异常
【发布时间】:2013-02-01 00:19:46
【问题描述】:

我正在使用 Visual Studio 2012 Express for Web。

当我尝试添加视图时,我收到一条错误消息:

The templates had the following 1 error(s)

C:\Program Files\Microsoft Visual Studio
11.0\Common7\IDE\VWExpress\ItemTemplates\CSharp\Web\MV
C 3\CodeTemplates\AddView\CSHTML\Empty.tt(-1,-1): error :
There was a problem getting an AppDomain to run the
transformation from the host.  The process cannot continue.

我一直在插入 Ninject(这实际上只是一个应用程序来证明它正在工作)所以它可能与其中一个启动文件有关。

我从哪里开始尝试解决这个问题?

谢谢

戴夫

【问题讨论】:

  • 尝试重启Visual Studio 2012,并在你的项目中添加一个视图
  • @Karthik,成功了。如果您想将其添加为答案,我会将其标记为这样。知道为什么会这样吗?

标签: asp.net-mvc-3 visual-studio-2012 ninject


【解决方案1】:

现在尝试重新启动 Visual Studio 2012 并添加一个视图,这应该对你有用。

您是否已将Code Templates 文件夹复制到您的项目中?

【讨论】:

  • 不,只是一直在玩弄温莎城堡和宁杰特,所以在玩初创公司的东西。
  • 我不知道这有什么问题,但我在 [connect.microsoft.com](connect.microsoft.com/VisualStudio/feedback/details/736308/…) 上看到了这个问题,你可以看到微软的帖子,因为他们是也在尝试修复它
  • 这个解决方案对我来说很奇怪,尽管我在打开项目后没有向我的项目添加任何新的 .tt 模板。关闭 Visual Studio 导致解决方案被保存,这可能是问题的根源。我确实在上一个会话中的项目中有 .tt 文件,但无论是在它不起作用时,还是在关闭 Visual Studio 并重新打开它之后,都是如此。
【解决方案2】:

重新启动对我不起作用。事实证明,mvc3 从未安装在我的机器上(mvc4 已经到位),而且我的 Visual Studio 副本也想安装 Service Pack 1。所以我使用控制面板重新启动了 Visual Studio,卸载了新版本的 newget。服务包 (sp1) 已成功安装。现在我的自定义 .tt 文件成功呈现新视图。

引导我走上这条路的信息:

http://forums.asp.net/t/1820254.aspx?MVC+Add+View+Model+Controller+from+template+throws+an+error

http://forums.asp.net/t/1729674.aspx?Installing+MVC3+after+Installing+MVC4

【讨论】:

    猜你喜欢
    • 2016-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多