Asp.net mvc aspnet核心代码生成器无法创建脚手架控制器

Asp.net mvc aspnet核心代码生成器无法创建脚手架控制器,asp.net-mvc,scaffolding,.net-core,Asp.net Mvc,Scaffolding,.net Core,我有一个aspnet core v1.0.1应用程序,我已将模型/迁移提取到一个单独的程序集中。我添加了一个新模型,但当我尝试使用scaffold创建控制器时,出现以下错误: Finding the generator 'controller'... Running the generator 'controller'... Attempting to compile the application in memory There was an error creating/modifying

我有一个aspnet core v1.0.1应用程序,我已将模型/迁移提取到一个单独的程序集中。我添加了一个新模型,但当我尝试使用scaffold创建控制器时,出现以下错误:

Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to compile the application in memory
There was an error creating/modifying a DbContext, there was no type returned after compiling the new assembly successfully
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)

有什么办法可以解决这个问题吗?

当模型位于当前项目之外时,听起来脚手架目前存在一些问题。作为一种解决方法,您可以将模型临时添加到web项目中,然后在搭建之后将其移动到BLL/DAL项目中

我的团队在这种设置中遇到的问题示例(与您遇到的情况不完全相同,但我认为我们的设置非常相似,问题可能是由于相同的问题):

最近提交修复此问题(表示已批准版本1.0.0-preview2-update1):


因此,我认为直到1.0.0-preview2-update1,只要您有一个将内容拆分为多个程序集的项目,这将仍然是一个问题。在我的例子中,项目设置太复杂,无法将内容复制到一个项目中。。。因此,我只能把头撞在墙上:(然后开始键入搭建的代码。

最后我自己键入了代码,我还做了另一个项目,看看它会生成什么。我会在更新时再尝试一下。
"C:\Program Files\dotnet\dotnet.exe" aspnet-codegenerator --project "C:\Projects\CompetitionScores\src\CSWebSite" controller --force --controllerName ClubsController --model CompetitionScores.Data.Models.Club --dataContext CompetitionScores.Data.CompetitionScoresDbContext --relativeFolderPath Controllers --controllerNamespace CSWebSite.Controllers --referenceScriptLibraries --useDefaultLayout