我已经在 Windows 10 上安装了 VS 2019。
创建 ASP.net Core Web 项目 -> 选定的 API。
当我尝试生成引用模型的 Controller 并创建上下文类时,
它没有生成 Controller 类,但它给了我以下错误:
错误,
运行所选代码生成器时出错
'Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=3.1.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)
最佳答案
我也有这个问题,但以下答案对我有用。
选择“管理 Nuget 包”并安装这些包
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" ExcludeAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGenerators.Mvc" Version="3.1.2" />
关于c# - 运行所选代码生成器 : 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61442242/