Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not locate .NET Core project. Assets were not generated

I just started learning C# a couple hours ago, but have since run into this error.

Ctrl + Shift + P

.NET:Generate Assets for Build and Debug

But when I click it, an error pops up bottom right of the window:

Could not locate .NET Core project. Assets were not generated.

like image 510
Harry Rawlins Avatar asked Aug 11 '20 16:08

Harry Rawlins


2 Answers

Restarting VS Code solved the problem in my case.

like image 100
AlexProutorov Avatar answered Sep 20 '22 01:09

AlexProutorov


This same thing started happening to me on my mac on vscode. For me, it was because I didn't add my dotnet project to my solution file after I created the solution file and project.

This is essentially how I created my project:

  1. Create empty project folder mkdir RecipeApp && cd RecipeApp

  2. Add Solution File to Project (uses the name of containing folder) dotnet new sln

  3. Create Backend .NET API dotnet new webapi -o API

Then this is the part I forgot to do (which actually solved a few other problems I was having, like I couldn't use the CMD + . feature to auto import classes and assets etc, too):

  1. Add the sub project to the solution file dotnet sln add API

After I added the API subproject to the solution file, I could open the main top level project folder in vscode, and everything started working again.

like image 43
kiko carisse Avatar answered Sep 18 '22 01:09

kiko carisse