I have installed VS 2019 on my windows 10. Created ASP.net Core Web Project -> Selected API. When I try to generate controller referring the model and created the context class, It is not generating the controller class but it gives me the following error:
Error, there was an error running the selected code generator
'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)
I also had this problem but the follwing answer worked for me. Select "Manage Nuget Packages" and install these packages
<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" />