Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still a problem with Dotnet core 3.1.301 #1382

Closed
eren-dhoheiri opened this issue Aug 6, 2020 · 9 comments
Closed

Still a problem with Dotnet core 3.1.301 #1382

eren-dhoheiri opened this issue Aug 6, 2020 · 9 comments

Comments

@eren-dhoheiri
Copy link

Still a problem with Dotnet core 3.1.301
the output of dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.1.302
 Commit:    41faccf259

Runtime Environment:
 OS Name:     zorin
 OS Version:  15
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.302/

Host (useful for support):
  Version: 3.1.6
  Commit:  3acd9b0cd1

.NET Core SDKs installed:
  3.1.302 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

output of dotnet aspnet-codegenerator controller -name ServerController -async -api -m Server -dc ServerContext -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: 'Server'
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:04.48

output of ls -l ~/.nuget/packages/microsoft.visualstudio.web.codegenerators.mvc/3.1.4/Templates/ControllerGenerator/

total 36
-rwxrw-r-- 1 jared jared  1293 Aug  3 18:28 ApiControllerWithActions.cshtml
-rwxrw-r-- 1 jared jared  4901 Aug  3 18:28 ApiControllerWithContext.cshtml
-rwxrw-r-- 1 jared jared   411 Aug  3 18:28 ApiEmptyController.cshtml
-rwxrw-r-- 1 jared jared  2389 Aug  3 18:28 ControllerWithActions.cshtml
-rwxrw-r-- 1 jared jared   407 Aug  3 18:28 EmptyController.cshtml
-rwxrw-r-- 1 jared jared 10197 Aug  3 18:28 MvcControllerWithContext.cshtml

Originally posted by @Jaredes0514 in #559 (comment)

@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Aug 7, 2020

possible dup of #1384
@eren-dhoheiri can you change the title to "A file matching the name ApiControllerWithContext.cshtml" ?

@lampsbr
Copy link

lampsbr commented Nov 13, 2020

I just installed dotnet 5 in my ubuntu 20.04, was following the rest api tutorial and this problem still exists.

@marcovelarde
Copy link

Same problem here using dotnet 5.

@Hackjaku
Copy link

Same using dotnet 5 on Linux

@Rick-Anderson
Copy link
Contributor

Try the following:

dotnet tool  uninstall  -g dotnet-aspnet-codegenerator
dotnet tool install -g dotnet-aspnet-codegenerator

@lampsbr
Copy link

lampsbr commented Nov 19, 2020

@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

@Rick-Anderson
Copy link
Contributor

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

  • Update your computer (mostly so it doesn't do a reboot before you complete)
  • Install VS on Windows Sandbox.
  • Try in the sandbox.

@Yakkhini
Copy link

Yakkhini commented Feb 2, 2021

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).

@deepchoudhery
Copy link
Member

fixed for dotnet-scaffold, closing., please use the new 'dotnet-scaffold' tool. Blog here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants