question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scaffolding failed. Could not load information for project

See original GitHub issue

Expand on this issue

  1. You won’t have this error if your project doesn’t have the “ProjectReference”
  2. When you add “ProjectReference” and try adding Scaffolded now you will get this error

Video:

https://user-images.githubusercontent.com/41800233/190883749-c2e28236-f948-432a-bc69-73518d48541a.mp4

Include stack traces

"[Trace]: Command Line: --project D:\WebProjects\ScaffoldingTest\ScaffoldingTest\ScaffoldingTest.csproj --no-build --port-number 49754 area Afa --dispatcher-version 2.0.0 --no-dispatch --simulation-mode
Scaffolding failed.
Could not load information for project D:\WebProjects\ScaffoldingTest\ScaffoldingTest.Model\ScaffoldingTest.Model.csproj
[Trace]:    at Microsoft.VisualStudio.Web.CodeGeneration.Utils.RoslynWorkspaceHelper.GetProjectReferenceInformation(IEnumerable`1 projectReferenceStrings)
   at Microsoft.VisualStudio.Web.CodeGeneration.Utils.RoslynWorkspace..ctor(IProjectContext projectInformation, String configuration)
   at Microsoft.VisualStudio.Web.CodeGeneration.Design.CodeGenCommandExecutor.AddFrameworkServices(ServiceProvider serviceProvider, IProjectContext projectInformation)
   at Microsoft.VisualStudio.Web.CodeGeneration.Design.CodeGenCommandExecutor.Execute(Action`1 simModeAction)
   at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.<>c__DisplayClass4_0.<<Execute>b__0>d.MoveNext()"

Edit After I tried debugging https://github.com/dotnet/Scaffolding/blob/f9d5980105a2f1604e98a330b51a8959fe870097/src/Scaffolding/VS.Web.CG.Utils/Workspaces/RoslynWorkspaceHelper.cs#L12 I found the problem was that the project could not be obtained https://github.com/dotnet/Scaffolding/blob/f9d5980105a2f1604e98a330b51a8959fe870097/src/Scaffolding/VS.Web.CG.Utils/Workspaces/RoslynWorkspaceHelper.cs#L20

innerException: InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.

Include provider and version information

Microsoft.VisualStudio.Web.CodeGeneration.Design version: 6.0.9 Target framework: .Net 6 Operating system: Windows 10 (21H2) IDE: Visual Studio Version 17.3.4

Edit: Found a solution (pending fix)

  1. Unload another project https://github.com/dotnet/Scaffolding/issues/2019#issuecomment-1250187016 or
  2. Make a new project, add scaffolding then copy to the main project https://github.com/dotnet/Scaffolding/issues/2019#issuecomment-1251531466

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:59 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
aironangelcommented, Sep 19, 2022

I’m experiencing the same bug scaffolding identity on a multi project solution. I’m using 6.0.9 version of net core libraries.

3reactions
saimankhatiwadacommented, Sep 19, 2022

Make new project with same solution and project name and add DB context and other necessary thing than scaffold then the new added files add in the main project you are making, now you are good to go.

On Tue, Sep 20, 2022, 01:39 Deep Choudhery @.***> wrote:

Yep investigating the same issue, will try to fix it ASAP. Thanks for the patience. If I find a workaround, will let you all know.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/Scaffolding/issues/2019#issuecomment-1251479129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKOPZ4I2XP6GL5JSQPGXBMLV7DAIRANCNFSM6AAAAAAQPIC2NQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Asp.net core 6 / Scaffolding failed, Could not load ...
As you can see, I only have two projects : one web app MVC (.net 6) and one class librairy. When i add...
Read more >
EF razor add CRUD scaffolding: there was an error running ...
EF razor add CRUD scaffolding: there was an error running the selected code ... scaffolding failed: could not load information for project.
Read more >
Scaffolding does not work for the projects with multiple ...
Scaffolding does not work for the projects with multiple target frameworks. Try to add a scaffolded item. The result is:
Read more >
Scaffolding in empty ASP.NET Core projects fails when . ...
We have fixed the problem in an upcoming release. The problem is because it is not being able to add package Microsoft. VisualStudio....
Read more >
How To Fix Common Errors Using ASP.NET MVC Scaffolding
Make sure to select a model and a data context class. Otherwise, the Add button of the dialog won't be enabled and you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found