c# - 错误 : multiple types matching the name while Scaffolding ASP. NET Core MVC RC2

标签 c# visual-studio asp.net-core asp.net-core-mvc asp.net-mvc-scaffolding

我正在根据 n 层架构在 Asp.Net Core RC2 中开发 Web 应用。

enter image description here

当我尝试使用脚手架生成 CRUD Controller 和 View 时,出现以下错误。

enter image description here

我已将我的模型/ View 模型和上下文/存储库类分别分为业务逻辑层和数据访问层。我将 OpenBiz 项目中的这两个层都引用为 nuget 包。但是不能像上面看到的那样执行脚手架。我的架构有问题还是我遗漏了什么?

最佳答案

来自 Github 的回复:

currently there is an issue with scaffolding, that it doesn't support model classes outside of the current project properly.

As a workaround, you can add the model temporarily to your web project and then move it to the BLL/ DAL projects after scaffolding.

另外他们还开了this issue as a bug , 引用:

Scaffolding fails if model class is in a dependency (project/ library) of the project on which scaffolding is being run. #251

Project A has a dependeny on Project B. Project B has model class If you try to run scaffolding on Project A by using model class from Project B, it fails with the below error: No model type returned for type:

因此,从 RC2 开始,这是脚手架工具中的错误。

关于c# - 错误 : multiple types matching the name while Scaffolding ASP. NET Core MVC RC2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37723998/

相关文章:

将字符串复制到 malloc 的字符串数组

c# - Visual Studio 2015 中的 Bower 错误

swift - 使用 SwiftR 的 Swift 中的 SignalR - 协商请求期间出错

c# - 在每像素碰撞后控制玩家移动

c# - .Net 4.7项目可以引用.Net Core 2.0类库吗?

c# - WPF 中的图像变得模糊

wpf - 如何在 WinForms 应用程序中的 WPF 窗口上使用实时可视化树?

c# - Excel 2016 在保存错误时触发撤消?

c# - 如何关闭未使用的用途变灰?

asp.net-core - 如何在 ASP.net vNext 中引用不同文件夹中的项目