脚手架控制器不适用于 Visual Studio 2013 更新 2 [英] Scaffolding controller doesn't work with visual studio 2013 update 2

查看:26
本文介绍了脚手架控制器不适用于 Visual Studio 2013 更新 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已更新到 Visual Studio 2013 更新 2,现在我无法搭建控制器.

I have updated to Visual Studio 2013 update 2 and now I cannot scaffold controllers.

问题不是特定于项目的:当我尝试搭建控制器时,我在所有和任何项目中都收到以下错误:

The problem is not project specific: when I try to scaffold a controller, I get the following error in ALL and ANY project:

There was an error running the selected code generator:
'Exception has been thrown by the target of an invocation.'

在更新到 Visual Studio 2013 更新 2 之前它可以工作.

It was working before updating to Visual Studio 2013 update 2.

已经在谷歌上搜索了这个问题,但各种建议都不起作用

Have googled the issue to death, but none of the various suggestions work

例如:

  1. 在我的上下文中注释掉 OnModelCreating;

  1. Commenting out OnModelCreating in my context;

删除 MvcScaffolding 等软件包(我没有安装,它不适用于任何项目);

Removing packages such as MvcScaffolding, etc (I have none installed and it doesn't work with ANY project);

我已经修改/自定义了一些模板,但在更改后可以正常工作.

I have modified/customised some of the templates, but it was working after the changes.

我卸载了 Visual Studio 2013 Update 2,从而恢复到 Visual Studio 版本 12.0.21005.1 REL.

I uninstalled Visual Studio 2013 Update 2 and thereby reverted to Visual Studio version 12.0.21005.1 REL.

问题消失了.因此,问题肯定出在更新 2 上.

The problem has disappeared. Therefore, the problem is quite definitely with Update 2.

有人(包括 Microsoft)知道修复程序吗?

Does anyone (including Microsoft) know of a fix?

Farruk Subhani 的回答没有解决问题:问题明确指出,删除对 MVCScaffolding 的引用并不能解决问题.

Farruk Subhani's answer does not address the question: The question clearly states that removing references to MVCScaffolding does not solve the issue.

我已经添加了 200 点的奖励,请按照明确说明的方式解决问题.

I have added a 200 point bounty, please address the question as clearly stated.

推荐答案

多种方法对我有用:

  1. 升级到 Visual Studio 2013 更新 3.

  1. Upgrade to Visual Studio 2013 Update 3.

将实体框架升级到 6.1.1

Upgrade Entity Framework to 6.1.1

修改上下文配置以使用 IDbSet<...> 而不是 DbSet<...>(我听说这会影响使用异步操作,但在我的情况下并不明显,因为我在我的登录操作等,由 ASP.NET Identity 2 示例 Nuget 包提供).

Modify the context configuration to use IDbSet<...> instead of DbSet<...> (I have heard that this can affect using async actions, but not apparently in my case, as I use this in my login actions, etc, as supplied by ASP.NET Identity 2 sample Nuget package).

为什么这种组合有效,我不知道.但考虑到 MS 雷鸣般的沉默,我可能并不孤单.我猜更新 2 没用...

Quite why this combination works, I have no idea. But then given the thundering silence from MS, I am probably not alone. I guess update 2 just didn't work...

这篇关于脚手架控制器不适用于 Visual Studio 2013 更新 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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