2

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

Community
  • 1
  • 1
Tipo33
  • 81
  • 5
  • https://stackoverflow.com/a/55264997/10634638 – bestinamir Mar 02 '20 at 04:41
  • Add the reference for library – Malakiya sanjay Mar 02 '20 at 05:00
  • The csproj file had the line: which I changed to but I got another error: error MSB4025: The project file could not be loaded. The 'ItemGroup' start tag on line 8 position 4 does not match the end tag of 'PackageReference'. Line 12, position 7. – Tipo33 Mar 02 '20 at 08:22
  • I would suggest just starting with "dotnet new web". Note that the project type is different for ASP.NET Core as well - it's not just adding packages. – Jon Skeet Mar 02 '20 at 09:36

1 Answers1

0

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

Community
  • 1
  • 1
Tipo33
  • 81
  • 5