![](/img/trans.png)
[英]Can I develop an Asp.net core MVC application using Entity Framework 6 (not Entity Framework core)?
[英]Problem scaffolding new controller using Entity Framework Core in ASP.NET Core 2.1 MVC
两天前我在做一个项目时遇到了一个问题。
当我尝试通过将鼠标悬停在View()
方法上然后单击“添加视图”来创建新控制器或视图时,VS 不会生成任何内容也没有错误消息,但这些行:
Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to compile the application in memory.
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
我试图将 VS 更新到最新版本,现在是 16.4.3 社区版,但没有运气。
试图从 NuGet 重新安装Microsoft.VisualStudio.Web.CodeGeneration
但再次没有运气。
试图删除 .vs 文件夹,但再次失败。
可能是什么问题呢? 在此之前它可以正常工作,但脚手架停止工作。
谢谢
我遇到过同样的问题。 Ubuntu 18.04.5 LTS,Rider EAP 2020.3。 C# 9,dotnet-aspnet-codegenerator 版本“5.0.1”,dotnet 5.0.102。
Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to compile the application in memory.
Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Person'
A file matching the name MvcControllerWithContext.cshtml was not found within any of the folders:
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
在绝望模式下开始尝试一切并遇到这个问题,它与我的配置一起工作。
在我的情况下,我修复了它,将项目的目标更改为“Net 5.0”(我知道这并不总是可行的),然后通过(工具/管理 Nuget 包)将这些包更新到最新版本(此时是5.0.9):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.