Unable to generate scaffolding
[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.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 6719f08e-3bd7-dc1a-71df-f2ef9fbca9d8
- Version Independent ID: 7096fdb3-612e-9e00-bd0b-8ea4886a09ce
- Content: Part 2, add a model to a Razor Pages app in ASP.NET Core
- Content Source: aspnetcore/tutorials/razor-pages/model.md
- Product: aspnet-core
- Technology: aspnetcore-tutorials
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande
Dup of https://github.com/dotnet/Scaffolding/issues/1382
@deepchoudhery I've had several folks report this.
I got the same problem following the official tutorial.
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.
I will try with Windows soon.
Anyone find a solution for this yet? I'm also running net core 5
@nicomigu what environment?
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?
@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
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.