AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Unable to generate scaffolding

Open sudhashbahu opened this issue 6 years ago • 8 comments

[Enter feedback here]

When trying the tutorial with VSCode on Linux (Core version 3.1) ...

Until the section "Register the database context". Everything is fine and the project builds

But in section "Scaffold the movie model" running the "dotnet aspnet-codegenerator razorpage" command gives:

Building project ... Finding the generator 'razorpage'... Running the generator 'razorpage'... Attempting to compile the application in memory. Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Movie' A file matching the name Create.cshtml was not found within any of the folders: at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.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.96


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

sudhashbahu avatar Aug 07 '20 09:08 sudhashbahu

Dup of https://github.com/dotnet/Scaffolding/issues/1382

@deepchoudhery I've had several folks report this.

Rick-Anderson avatar Aug 07 '20 19:08 Rick-Anderson

I got the same problem following the official tutorial.

sympho1 avatar Oct 01 '20 05:10 sympho1

Same issue, on Ubuntu 20.04.1 LTS when I follow the tutorial on https://www.youtube.com/watch?v=l2wE6KQuYRc at 35:49.

The error: dotnet aspnet-codegenerator razorpage -m Item -dc ItemsContext -udl -outDir Pages/Items --referenceScriptLibraries Building project ... Finding the generator 'razorpage'... Running the generator 'razorpage'... Attempting to compile the application in memory. Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Item' A file matching the name Create.cshtml was not found within any of the folders: at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.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:05.82

I will try with Windows soon.

tradercentric avatar Oct 09 '20 05:10 tradercentric

Anyone find a solution for this yet? I'm also running net core 5

nicomigu avatar Nov 30 '20 16:11 nicomigu

@nicomigu what environment?

Rick-Anderson avatar Nov 30 '20 18:11 Rick-Anderson

I'm running net core 5 on Ubuntu 18.04 LTS . I have followed the Razor Pages tutorial well but this shows up. Anybody solved it yet?

rainmaker29 avatar Dec 08 '20 12:12 rainmaker29

@nicomigu what environment?

$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

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

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

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

I have faced the problem doing Razor Pages Tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-5.0&tabs=visual-studio-code

The solution which works without switching to a certain .net core version is: https://stackoverflow.com/a/65065879/3052214

SirBald avatar Dec 11 '20 15:12 SirBald

I stumbled on the solution from comment on another similar issue: https://github.com/dotnet/Scaffolding/issues/1387#issuecomment-671237263 Basically just downgrade the dotnet-aspnet-codegenerator to version 3.1.0, works like a charm.

rudilee avatar Jan 06 '21 05:01 rudilee