dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.54k stars 25.31k forks source link

Scaffolding failed #20467

Closed LorenMayhew closed 3 years ago

LorenMayhew commented 3 years ago

When trying to add the scaffolding as instructed on this page the following errors are generated: Unexpected character encountered while parsing number: . Path '', line 1, position 1. Scaffolding failed. Unexpected character encountered while parsing number: . Path '', line 1, position 1. To see more information, enable tracing by setting environment variable 'codegen_trace' = 1.


Document Details

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

Rick-Anderson commented 3 years ago

Are you using 2.1? Can you use 3.1 or 5.0? Scaffolding errors should be reported at https://github.com/dotnet/Scaffolding/issues

LorenMayhew commented 3 years ago

Dear Rick:

What does 2.1, 3.1, or 5.0 refer to? I version 16.8.1 of Visual Stodio and 4.8.04084 of Microsoft .NET framework.

[cid:image001.png@01D6BB93.79819390]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Tuesday, November 10, 2020 10:55 AM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Are you using 2.1? Can you use 3.1 or 5.0? Scaffolding errors should be reported at https://github.com/dotnet/Scaffolding/issues

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-724865665, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWU2ICLXJM2PZAE37O3SPF45VANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

What does 2.1, 3.1, or 5.0 refer to?

dotnet --version

LorenMayhew commented 3 years ago

My VS is using .NET 4.8.0804. How do I change it to 5.0?

Scaffolding does not appear to be very stable. When I searched on GitHub there were 3,684 reports of failures.

[cid:image001.png@01D6BB96.C7F48E30]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Sunday, November 15, 2020 9:24 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

What does 2.1, 3.1, or 5.0 refer to?

dotnet --version

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-727726403, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWR2R5Y2OUDWNEQ4IKTSQCSMXANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

This tutorial doesn't support .NET 4.8 framework. It only support ASP.NET Core and .NET

Rick-Anderson commented 3 years ago

Scaffolding is very stable.

LorenMayhew commented 3 years ago

Obviously I don't know what I am doing. How do I get VS to use ASP.NET Core for the tutorials?

Rick-Anderson commented 3 years ago

If you follow the instructions, it use ASP.NET Core.

LorenMayhew commented 3 years ago

Dear Rick:

I gave up and deleted all the RazorPagesMovie folders and files from my computer and started over from scratch. This time I saw where the ASP.NET Core version is selected; I selected version 5.0. After creating the RazorPagesMovie project, I searched through all the created files and cannot find the secret place where ASP.NET Core 5.0 is specified. Where is it to be found? I am trying to understand and would like to know.

After creating the Movie class, I built the project with 0 errors.

This time scaffolding fails yet again but with a different error: Unexpected character encountered while parsing value: c. Path '', line 0, position 0. Scaffolding failed. Unexpected character encountered while parsing value: c. Path '', line 0, position 0.

Is there any hope of fixing these scaffolding errors so I can continue the tutorial?

[cid:image001.png@01D6BC52.C38AEC10]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Monday, November 16, 2020 10:31 AM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

If you follow the instructions, it use ASP.NET Core.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-728211619, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWRIK57IUZTKVFJ4OWTSQFOW7ANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

In the project.csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
Rick-Anderson commented 3 years ago

Try running the following in the command line

dotnet tool  uninstall  -g dotnet-aspnet-codegenerator
dotnet tool  install  -g dotnet-aspnet-codegenerator
LorenMayhew commented 3 years ago

Thank you. The code is different than yours but I found where it is. The corresponding code created in my RazorPagesMovie.csproj file is:

net5.0

[cid:image001.png@01D6BC5A.794398C0]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Monday, November 16, 2020 8:28 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

In the project.csproj file

netcoreapp3.1 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
LorenMayhew commented 3 years ago

I ran the two commands you gave, I got errors on the first uninstall command but the second install command completed successfully. Reran the scaffolding:

Unexpected character encountered while parsing value: o. Path '', line 0, position 0. Scaffolding failed. Unexpected character encountered while parsing value: o. Path '', line 0, position 0.

Now what?

[cid:image001.png@01D6BC5B.48DCE410]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Monday, November 16, 2020 8:35 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Try running the following in the command line

dotnet tool uninstall -g dotnet-aspnet-codegenerator

dotnet tool install -g dotnet-aspnet-codegenerator

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-728664965, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWVCIVST66JKA7ICJOLSQHVPFANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

Try running the Visual Studio installer again and select repair.

LorenMayhew commented 3 years ago

Dear Rick:

After running the repair option of the VS installer, same error.

So I uninstalled all of VS, downloaded a fresh install of VS Pro from my Microsoft Partner portal, and installed it. Same error:

Unexpected character encountered while parsing value: l. Path '', line 0, position 0. Scaffolding failed. Unexpected character encountered while parsing value: l. Path '', line 0, position 0.

[cid:image001.png@01D6BD29.711FDA30]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Monday, November 16, 2020 10:08 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Try running the Visual Studio installer again and select repair.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-728689078, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWU5RHIGRK3G3OAHD63SQIAKRANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

Did you try with a new project? We have lots of customers reporting success on this and you're the only one I know of with this failure.

Try following the CLI instructions. use the Visual Studio, Report a Problem gesture within VS, which open internal issues for the VS team.

Rick-Anderson commented 3 years ago

can you try the following (mostly from the command line)?

dotnet new webapp -o RazorPagesMovie
cd RazorPagesMovie
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet tool uninstall -g dotnet-aspnet-codegenerator 
dotnet tool install -g dotnet-aspnet-codegenerator 

// Add movie model to project
// Build run the app.
//  From project directory, run in a command window

dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

dotnet ef migrations add Initial
dotnet ef database update
LorenMayhew commented 3 years ago

Dear Rick:

Yes, I tried a new project from scratch. I don’t know what is meant by CLI instructions. I will try your command line approach next.

BTW RazorPagesMovie.Models.RazorPagesMovieContext doen’t work. The generated name on my environment is RazorPagesMovie.Data.RazorPagesMovieContext.

In appreciation,

[cid:image001.png@01D6BD7D.73A54160]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Tuesday, November 17, 2020 10:22 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Did you try with a new project? We have lots of customers reporting success on this and you're the only one I know of with this failure.

Try following the CLI instructions. use the Visual Studio, Report a Problemhttps://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio gesture within VS, which open internal issues for the VS team.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-729435501, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWQHU76RKW6T6NXH2Z3SQNKWTANCNFSM4TQFYEIA.

LorenMayhew commented 3 years ago

Hi Rick:

Been busy with holiday stuff this week. Since this still fails for me and I am the only one, I am going to give up on Windows 10 Home and rebuild my computer from scratch with Windows 10 Pro Enterprise and try again. This will take me a few days.

I really do appreciate your not giving up on me.

[cid:image001.png@01D6C64D.D284AC60]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Tuesday, November 17, 2020 10:25 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

can you try the following (mostly from the command line)?

dotnet new webapp -o RazorPagesMovie

cd RazorPagesMovie

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

dotnet tool install -g dotnet-aspnet-codegenerator --version 2.1.0

// Add movie model to project

// Build run the app.

// From project directory, run in a command window

dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

dotnet ef migrations add Initial

dotnet ef database update

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-729436569, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWR7643Q4J66ZK6GCYLSQNLCNANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

Try this first https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview#:~:text=Windows%20Sandbox%20provides%20a%20lightweight,and%20the%20state%20are%20deleted.

LorenMayhew commented 3 years ago

Clever. I hadn’t heard of the Sandbox before. However, it does not work in Windows 10 Home, so I still have to install Windows 10 Pro to use it. In my case, I have to reformat my hard drive and install Windows and everything else from scratch because Windows 10 says it cannot install over my existing installation and must wipe everything out.

[cid:image001.png@01D6C683.B594EDA0]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Sunday, November 29, 2020 6:37 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Try this first https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview#:~:text=Windows%20Sandbox%20provides%20a%20lightweight,and%20the%20state%20are%20deleted.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-735498272, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWVVI2WLSHYIRHIDUM3SSLZNNANCNFSM4TQFYEIA.

LorenMayhew commented 3 years ago

Dear Rick:

I don’t have good news, I’m afraid, as you can see from the attached pictures. The scaffolding still fails.

I am trying to learn Visual Studio web development so I can migrate from Expression Web, but this problem has me completely blocked. You said I should report this bug, but I forgot where you said to report it.

Is there any hope of getting through this tutorial? Is there another tutorial I should be using instead?

In case it is helpful, here is my System Information: OS Name Microsoft Windows 10 Enterprise Version 10.0.19042 Build 19042 Other OS Description Not Available OS Manufacturer Microsoft Corporation System Name LMS1 System Manufacturer Microsoft Corporation System Model Surface Pro 6 System Type x64-based PC System SKU Surface_Pro_6_1796_Consumer Processor Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 2112 Mhz, 4 Core(s), 8 Logical Processor(s) BIOS Version/Date Microsoft Corporation 235.3261.768, Not Available SMBIOS Version 3.2 Embedded Controller Version 255.255 BIOS Mode UEFI BaseBoard Manufacturer Microsoft Corporation BaseBoard Product Surface Pro 6 BaseBoard Version Not Available Platform Role Slate Secure Boot State On PCR7 Configuration Elevation Required to View Windows Directory C:\WINDOWS System Directory C:\WINDOWS\system32 Boot Device \Device\HarddiskVolume1 Locale United States Hardware Abstraction Layer Version = "10.0.19041.488" User Name AzureAD\CS Time Zone US Mountain Standard Time Installed Physical Memory (RAM) 16.0 GB Total Physical Memory 15.9 GB Available Physical Memory 8.44 GB Total Virtual Memory 18.3 GB Available Virtual Memory 9.23 GB Page File Space 2.38 GB Page File C:\pagefile.sys Kernel DMA Protection Off Virtualization-based security Not enabled Device Encryption Support Elevation Required to View Hyper-V - VM Monitor Mode Extensions Yes Hyper-V - Second Level Address Translation Extensions Yes Hyper-V - Virtualization Enabled in Firmware Yes Hyper-V - Data Execution Protection Yes

Sincerely,

[cid:image001.png@01D6D62B.E22BAFE0]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Tuesday, November 17, 2020 10:25 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

can you try the following (mostly from the command line)?

dotnet new webapp -o RazorPagesMovie

cd RazorPagesMovie

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

dotnet tool install -g dotnet-aspnet-codegenerator --version 2.1.0

// Add movie model to project

// Build run the app.

// From project directory, run in a command window

dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

dotnet ef migrations add Initial

dotnet ef database update

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-729436569, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWR7643Q4J66ZK6GCYLSQNLCNANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

Follow the VSC instructions:

can you try the following (mostly from the command line)?

dotnet new webapp -o RazorPagesMovie
cd RazorPagesMovie
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet tool uninstall -g dotnet-aspnet-codegenerator 
dotnet tool install -g dotnet-aspnet-codegenerator 

// Add movie model to project
// Build run the app.
//  From project directory, run in a command window

dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

dotnet ef migrations add Initial
dotnet ef database update
LorenMayhew commented 3 years ago

Hi Rick:

I carefully followed your instructions. Everything seemed OK up through the successful build after adding the Movie class to the Models. Here is the printout from the Developer PowerShell command prompts:


Visual Studio 2019 Developer PowerShell v16.8.3 Copyright (c) 2020 Microsoft Corporation


PS C:\Users\CS\source\repos> cd c:\users\cs.develop\vs\tutorials cd : Cannot find path 'C:\users\cs.develop\vs\tutorials' because it does not exist. At line:1 char:1

PS C:\Users\CS\source\repos> cd c:\users\cs\documents.develop\vs\tutorials PS C:\users\cs\documents.develop\vs\tutorials> dotnet new webapp -o RazorPagesMovie Getting ready... The template "ASP.NET Core Web App" was created successfully. This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/5.0-third-party-notices for details.

Processing post-creation actions... Running 'dotnet restore' on RazorPagesMovie\RazorPagesMovie.csproj... Determining projects to restore... Restored C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj (in 121 ms). Restore succeeded.

PS C:\users\cs\documents.develop\vs\tutorials> cd RazorPagesMovie PS C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie> dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design Determining projects to restore... Writing C:\Users\CS\AppData\Local\Temp\tmp5A15.tmp info : Adding PackageReference for package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' into project 'C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj'. info : GET https://api.nuget.org/v3/registration5-gz-semver2/microsoft.visualstudio.web.codegeneration.design/index.json info : OK https://api.nuget.org/v3/registration5-gz-semver2/microsoft.visualstudio.web.codegeneration.design/index.json 252ms info : Restoring packages for C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj... info : Package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' is compatible with all the specified frameworks in project 'C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj'. info : PackageReference for package 'Microsoft.VisualStudio.Web.CodeGeneration.Design' version '5.0.1' added to file 'C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj'. info : Committing restore... info : Generating MSBuild file C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\obj\RazorPagesMovie.csproj.nuget.g.props. info : Writing assets file to disk. Path: C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\obj\project.assets.json log : Restored C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie\RazorPagesMovie.csproj (in 2.04 sec). PS C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie> dotnet tool uninstall -g dotnet-aspnet-codegenerator A tool with the package Id 'dotnet-aspnet-codegenerator' could not be found.

Tools are uninstalled using their package Id which may be different from the tool name you use when calling the tool. You can find the tool names and the corresponding package Ids for installed tools using the command 'dotnet tool list'. PS C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie> 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.1') was successfully installed. PS C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie> dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries Building project ... Finding the generator 'razorpage'... Running the generator 'razorpage'... To scaffold controllers and views using models, install Entity Framework core packages and try again: Microsoft.EntityFrameworkCore.Design 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:14.73 PS C:\users\cs\documents.develop\vs\tutorials\RazorPagesMovie> dotnet ef migrations add Initial Could not execute because the specified command or file was not found. Possible reasons for this include:

Next I followed the VSC instructions as you suggested. I got all the way through the “Register the database context” and everything seemed OK as far as I could tell until the build at that point failed as follows (I am still too dumb to know what to do about them): Severity Code Description Project File Line Suppression State Error CS0103 The name 'SameSiteMode' does not exist in the current context RazorPagesMovie C:\Users\CS\Documents.Develop\VS\Tutorials\RazorPagesMovie\Startup.cs 33 Active Error CS0246 The type or namespace name 'RazorPagesMovieContext' could not be found (are you missing a using directive or an assembly reference?) RazorPagesMovie C:\Users\CS\Documents.Develop\VS\Tutorials\RazorPagesMovie\Startup.cs 36 Active Error CS0103 The name 'CompatibilityVersion' does not exist in the current context RazorPagesMovie C:\Users\CS\Documents.Develop\VS\Tutorials\RazorPagesMovie\Startup.cs 39 Active

[cid:image001.png@01D6D6EE.14EF5CC0]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Saturday, December 19, 2020 6:51 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Follow the VSC instructions:

can you try the following (mostly from the command line)?

dotnet new webapp -o RazorPagesMovie

cd RazorPagesMovie

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

dotnet tool uninstall -g dotnet-aspnet-codegenerator

dotnet tool install -g dotnet-aspnet-codegenerator

// Add movie model to project

// Build run the app.

// From project directory, run in a command window

dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovie.Data.MovieContext -udl -outDir Pages\Movies --referenceScriptLibraries

dotnet ef migrations add Initial

dotnet ef database update

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-748551170, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWSF4H736ALMDXIUZB3SVVKAPANCNFSM4TQFYEIA.

Rick-Anderson commented 3 years ago

Good error message To scaffold controllers and views using models, install Entity Framework core packages and try again: Microsoft.EntityFrameworkCore.Design 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)

Rick-Anderson commented 3 years ago

See https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-2.1&tabs=visual-studio-code#add-nuget-packages-and-ef-tools-2

LorenMayhew commented 3 years ago

Rick:

Yes, I saw those messages but am at a loss as to what to do about them. I searched the internet for Entity Framework core packages and found plenty of writeups but nothing about how to download them to install them. I also ran the .NET Core CLI commands mentioned in your follow up email. I didn’t see a scaffolding error amongst the blizzard of messages so did not run the next XML.

I used to be a Software Engineer at IBM about 28 years ago, but this stuff has me befuddled at the moment.

[cid:image001.png@01D6D6FF.56E76C60]Loren Mayhew Mail: PO Box 69654 ● Oro Valley AZ 85737-0019 ● USA Email: Biz@Mayhews.usmailto:Biz@Mayhews.us Telephone: +1 (520) 289-0700; Skype/WhatsAPP: Loren Mayhew

From: Rick Anderson notifications@github.com Sent: Sunday, December 20, 2020 6:24 PM To: dotnet/AspNetCore.Docs AspNetCore.Docs@noreply.github.com Cc: Business Biz@Mayhews.us; Author author@noreply.github.com Subject: Re: [dotnet/AspNetCore.Docs] Scaffolding failed (#20467)

Good error message To scaffold controllers and views using models, install Entity Framework core packages and try again: Microsoft.EntityFrameworkCore.Design 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)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/AspNetCore.Docs/issues/20467#issuecomment-748708151, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOILEWS2H2LNJKUKDS27ZRDSV2PTBANCNFSM4TQFYEIA.