-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Follow up with Scaffolding issue Core 6.0.7 Visual Studio #26614
Comments
Hello! Thanks for contacting us. This sounds like a general question about using ASP.NET Core. While we try to look at and respond to all issues, for questions like this we recommend posting to a community support group like Stack Overflow with the Potential bugs in the ASP.NET Core framework and product feedback can be reported at dotnet/aspnetcore issues (include full repro steps and cross-link to a repro project in GH when appropriate). For Visual Studio, use the Report a Problem gesture or Suggest a Feature gesture within VS, which open internal issues for the VS team. For Visual Studio Code, you can open an issue at microsoft/vscode issues. |
hcprobst commented 4 days ago
[Enter feedback here]
Whenever I try to add a scaffold to my controllers I get an error message and am unable to add the needed items
Finding the generator 'controller'...
Running the generator 'controller'...
Minimal hosting scenario!
Generating a new DbContext class 'TuitionWaiver.Data.TuitionWaiverContext'
Object reference not set to an instance of an object.
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)
I had the same issues trying to do this in the RazorPagesMovie60 tutorial.
I need this to work please
Suggestions?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@dotnet-bot dotnet-bot added ⌚ Not Triaged Source - Docs.ms labels 4 days ago
@wadepickett
Contributor
wadepickett commented 4 days ago •
@hcprobst, it sounds like either one of the packages that are required are not there, the wrong version or you might have an outdated global tool that you have to actually remove, before updating.
Try the following:
Verify the tool versions you have by running the following at the command line:
dotnet tool list -g
You should see the following result with this version or higher (this tutorial does not use preview versions such as for 7.0):
dotnet-aspnet-codegenerator 6.0.6 dotnet-aspnet-codegenerator
dotnet-ef 6.0.6 dotnet-ef
Before installing the latest of the dotnet tool dotnet-ef you need to first uninstall it:
dotnet tool uninstall dotnet-ef --global
Verify your list of installed packages and their version for your MvcMovie project, at the project directory, with the following command:
dotnet list MvcMovie.csproj package --verbosity d
It is possible you might need to start over with a new project in the tutorial since we don't know what state it is in, but try what I suggested above first.
Another possibility is that when running the commands to install packages at the command line, if you paste in several commands to install at once and hit return, you can still need to hit return one more time for the very last line to run, otherwise you are missing that last package. It is easy to miss.
I will close this issue. For more troubleshooting you can try the community at stackoverflow.com. Feel free to reopen this issue if you have more information and feel there is a change that needs to occur in the doc instead. Thanks very much for your feedback. Always appreciated.
@wadepickett wadepickett closed this as completed 4 days ago
@wadepickett wadepickett removed the ⌚ Not Triaged label 4 days ago
@wadepickett
Contributor
wadepickett commented 4 days ago
I updated the instruction above with version information.
@hcprobst
Author
hcprobst commented yesterday
I added the packages as you said and still get the same error, object not found.
There is definitely an issue with the documentation in that it doesn't say anything about adding the codegenerator or ef packages.
Now I wonder if I may be missing other packages.
I have
PM> dotnet list TuitionWaiver.csproj package --verbosity d
Project 'TuitionWaiver' has the following package references
[net6.0]:
Top-level Package Requested Resolved
I continue to get the error message
Finding the generator 'controller'...
Running the generator 'controller'...
Minimal hosting scenario!
Generating a new DbContext class 'Tuition_Waiver.Data.Tuition_WaiverContext'
Object reference not set to an instance of an object.
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)
I get this when I try to build at the command line
PM> dotnet build TuitionWaiver.csconfig scaffold
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Full command line: 'C:\Program Files\dotnet\sdk\6.0.302\MSBuild.dll -maxcpucount -verbosity:m -restore -consoleloggerparameters:Summary TuitionWaiver.csconfig scaffold -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\6.0.302\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\6.0.302\dotnet.dll'
Switches appended by response files:
Switch: scaffold
For switch syntax, type "MSBuild -help"
PM> dotnet build scaffold
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: scaffold
PM>
The text was updated successfully, but these errors were encountered: