dotnet / dotnet/core

ASP.NET Core scaffolding tool

Open
#7,672 6 comments 0 reactions 0 assignees View on GitHub
area-aspnet
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

### Description
error generated by running code in visual studio CLI:
PM> dotnet aspnet-codegenerator razorpage -m Student -dc ContosoUniversity.Data.SchoolContext -udl -outDir Pages\Students --referenceScriptLibraries -sqlite
dotnet : Scaffolding failed.
At line:1 char:1
+ dotnet aspnet-codegenerator razorpage -m Student -dc ContosoUniversity.Data.Scho ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Scaffolding failed.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

Could not find project file in C:\Users\awise303\source\repos\ContosoUniversity

############################################################
Alternatively tried manual installation and still get error even after rebuilding project. The following error:

dotnet : Could not find any project in `C:\Users\awise303\source\repos\ContosoUniversity\`.
At line:1 char:1
+ dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Could not find ...soUniversity\`.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

by following theses steps:

Create a Pages/Students folder.
In Solution Explorer, right-click the Pages/Students folder and select Add > New Scaffolded Item.
In the Add New Scaffold Item dialog:
In the left tab, select Installed > Common > Razor Pages
Select Razor Pages using Entity Framework (CRUD) > ADD.
In the Add Razor Pages using Entity Framework (CRUD) dialog:
In the Model class drop-down, select Student (ContosoUniversity.Models).
In the Data context class row, select the + (plus) sign.
Change the data context name to end in SchoolContext rather than ContosoUniversityContext. The updated context name: ContosoUniversity.Data.SchoolContext
Select Add to finish adding the data context class.
Select Add to finish the Add Razor Pages dialog.
The following packages are automatically installed:

Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
Microsoft.VisualStudio.Web.CodeGeneration.Design

### Configuration

### Regression?

### Other information

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.