在 Visual Studio 2019 中,我正在尝试安装一些 NuGet 包以修复自动脚手架(在 ASP.NET MVC 5 中创建带有视图的控制器)。
如果我尝试:
Install-Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc -v 3.1.5
然后出现2个“黄色”错误:
Install failed. Rolling back...
Package 'Microsoft.VisualStudio.Web.CodeGenerators.Mvc.3.1.5 : Microsoft.VisualStudio.Web.CodeGeneration [3.1.5, )' does not exist in project 'SampleProject'
Package 'Microsoft.VisualStudio.Web.CodeGenerators.Mvc.3.1.5 : Microsoft.VisualStudio.Web.CodeGeneration [3.1.5, )' does not exist in folder 'C:\Users\x\SampleProject\packages'
应该丢失的包已经安装了。
还有 1 个“红色”错误:
Install-Package : Could not find a part of the path 'C:\Users\x\SampleProject\packages\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.3.1.5\Templates/Identity_Versioned/Bootstrap3/Pages/Account/
Manage/Account.Manage.TwoFactorAuthentication.cs.cshtml'.
At line:1 char:1
有没有办法避免对“红色”错误中出现的“TwoFactorAuthentication.cs.cshtml”的硬依赖?该项目不使用 2FA。