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.
Restarting VS Code solved the problem in my case.
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:
Create empty project folder mkdir RecipeApp && cd RecipeApp
Add Solution File to Project (uses the name of containing folder) dotnet new sln
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):
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With