且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.Net Core中的支架与解决方案中的多个项目

更新时间:2023-02-15 12:38:12

无法发表评论,所以我不得不写一个答案.我也遇到了同样的问题,并在Scaffolding github存储库上将其打开.这是响应:

Cannot post a comment, so I've to write an answer instead. I also had the same issue and opened it on Scaffolding github repository. Here's the response:

目前脚手架存在问题,它不支持 在当前项目外部正确地建模.

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

作为一种解决方法,您可以将模型临时添加到Web项目中 然后在脚手架上将其移至BLL/DAL项目.

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

此外,他们还打开了此问题作为错误,并引用:

Plus they also opened this issue as a bug, quoting:

如果模型类在依赖项中,则脚手架折叠将失败(项目/库) 正在运行脚手架的项目. #251

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

项目A依赖于项目B.项目B具有模型类If 您尝试通过使用以下模型类在Project A上运行脚手架 项目B,它失败,并出现以下错误:没有返回任何模型类型 类型:

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开始,这是脚手架工具中的错误.

Hence, as of RC2, this is a bug in scaffolding tooling.