Open eren-dhoheiri opened 4 years ago
possible dup of #1384 @eren-dhoheiri can you change the title to "A file matching the name ApiControllerWithContext.cshtml" ?
I just installed dotnet 5 in my ubuntu 20.04, was following the rest api tutorial and this problem still exists.
Same problem here using dotnet 5.
Same using dotnet 5 on Linux
Try the following:
dotnet tool uninstall -g dotnet-aspnet-codegenerator
dotnet tool install -g dotnet-aspnet-codegenerator
@Rick-Anderson I tried but it still didn't work:
$ dotnet tool uninstall -g dotnet-aspnet-codegenerator Tool 'dotnet-aspnet-codegenerator' (version '5.0.0') was successfully uninstalled. $ dotnet tool install -g dotnet-aspnet-codegenerator You can invoke the tool using the following command: dotnet-aspnet-codegenerator Tool 'dotnet-aspnet-codegenerator' (version '5.0.0') was successfully installed. $ dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers Building project ... 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: 'TodoItem' A file matching the name ApiControllerWithContext.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) RunTime 00:00:09.09
@lampsbr we've got thousands of customers reporting success. Most likely, you're missing a step or something is wrong with your computer. If you're confident you haven't missed a step, you could try the following:
There is a templates folder in /home/yourusername/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/5.0.1/, which contains many templates needed, but in ubuntu, Vscode can't use it correctly. So you can copy whole Templates folder in your project folder(without two identity template subfolders).
Still a problem with Dotnet core 3.1.301 the output of
dotnet --info
output of
dotnet aspnet-codegenerator controller -name ServerController -async -api -m Server -dc ServerContext -outDir Controllers
output of
ls -l ~/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/3.1.4/Templates/ControllerGenerator/
Originally posted by @Jaredes0514 in https://github.com/dotnet/Scaffolding/issues/559#issuecomment-668844613