C# Error CS0234 even after adding aspnetcore and extensions packages

Viewed 239

I have a C# code that I am trying to run on VS Code. The steps I went through are as follows:

  1. create folder (for this case we will name it "Program") for the program files and then run

dotnet new console

  1. Replace the Program.cs file inside the "Program" folder with the Program.cs file I intend to run ( I did this with earlier C# applications and it worked)

  2. Run the following commands to add packages:

dotnet add package aspnetcore

dotnet add package extensions

All packages above were installed successfully

  1. I ran the command

dotnet build

but received the following errors:

error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Please tell me how I am to resolve this issue. Thank you

1 Answers

I implemented the solution by Jon Skeet , where I created a new folder and then used the command

dotnet new web

and managed to create a new ASP.NET Core project, complete with all the necessary libraries and links.

Thanks guys

I then transferred the files and folders I needed into this new folder and

Related