question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A file matching the name ApiControllerWithContext.cshtml was not found within any of the folders:

See original GitHub issue

Note: If filing an issue related to using Scaffolding within Microsoft Visual Studio, please file an issue on the Microsoft Developer Community instead of here. This can be accomplished from Visual Studio by clicking on Help > Send Feedback, and choosing the appropriate action.

Steps to reproduce:

dotnet aspnet-codegenerator controller -name TodoItemsController -async -api -m TodoItem -dc TodoContext -outDir Controllers

Expected behavior:

Should run without any errors

Actual behavior:

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:06.25

Additional information about the project being scaffolded, such as:

I am using vs code in Ubuntu 18.04

Target framework(s):

dotnet core 3.1

Package version of Microsoft.AspNetCore.App or Microsoft.AspNetCore.All (if applicable):

3.1

Package version of Microsoft.VisualStudio.Web.CodeGeneration.Design - this may be added to your project by scaffolding:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:38 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
LeandroRezendeCoutinhocommented, Dec 2, 2020

Solution commands

On project folder execute

mkdir Templates && mkdir Templates/ControllerGenerator && mkdir Templates/ViewGenerator

cp -r /home/$USER/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/5.0.0/Templates/ControllerGenerator/* ./Templates/ControllerGenerator

cp -r /home/$USER/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/5.0.0/Templates/ViewGenerator/* ./Templates/ViewGenerator/

18reactions
jahnogcommented, Sep 9, 2020

I had the same problem. The version is dotnet-sdk-3.1 is 3.1.401-1 aspnet-codegenerator is 3.1.4. I tried Downgraded each to 3.1.302-1 and 3.1.3. Then it worked. With only one downgrade, it didn’t work. My environment is Linux Mint 19.3.

can you share step for downgrade?

sudo apt-get remove dotnet-sdk-3.1 --purge sudo apt-get install dotnet-sdk-3.1=3.1.302-1 sudo apt-mark hold dotnet-sdk-3.1 dotnet tool uninstall -g dotnet-aspnet-codegenerator dotnet tool install -g dotnet-aspnet-codegenerator --version 3.1.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Asp.NET Core, unable to find View of cshtml when published
The issue is that when the website is published the service is unable to find path to Views/Emails/EmailRiepilogo.cshtml as on publish the View ......
Read more >
Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll
Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll. This report is generated from a file or URL submitted to this webservice on January 17th 2019 14:27:56 ...
Read more >
Telerik Kendo UI Master Detail Grids with full edits using ...
Create a new folder structure at the solution root. Templates\ControllerGenerator. Copy “ApiControllerWithContext.cshtml” from “C:\Program Files ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found