Creating a new project in asp.net core 2.1
Here's a step-by-step guide to creating a new project in ASP.NET Core 2.1:
Prerequisites:
*.NET Core 2.1 SDK installed on your machine
- Visual Studio 2017 or later (or Visual Studio Code with the.NET Core extension)
Step 1: Open Visual Studio
- Launch Visual Studio 2017 or later.
- If you have multiple versions of Visual Studio installed, make sure you're using the correct one.
Step 2: Create a new project
- Click on "File" > "New" > "Project..." (or press
Ctrl + Shift + N
). - In the "New Project" dialog box, select ".NET Core" under the "Visual C#" section.
- Choose "ASP.NET Core Web Application" from the list of project templates.
- Click "Next".
Step 3: Configure the project
- In the "Create a new ASP.NET Core web application" dialog box:
- Enter a name for your project (e.g., "MyNewProject").
- Choose a location to save your project.
- Select ".NET Core 2.1" as the target framework.
- Choose "Web Application" as the project template.
- Select "Empty" as the project template (this will create a basic project structure without any pre-built functionality).
- Click "Create".
Step 4: Configure the project settings
- In the "Solution Explorer" window, right-click on the project and select "Properties".
- In the "MyNewProject Properties" window:
- Set the "Target framework" to ".NET Core 2.1".
- Set the "Runtime" to ".NET Core 2.1".
- Click "OK".
Step 5: Create a new controller
- In the "Solution Explorer" window, right-click on the project and select "Add" > "Controller".
- In the "Add Scaffold" dialog box:
- Select "MVC Controller - Empty" as the controller template.
- Enter a name for your controller (e.g., "MyController").
- Click "Add".
Step 6: Create a new view
- In the "Solution Explorer" window, right-click on the project and select "Add" > "View".
- In the "Add View" dialog box:
- Select "MVC View" as the view template.
- Enter a name for your view (e.g., "Index").
- Click "Add".
Step 7: Run the project
- Press
F5
or click on the "Debug" > "Start Debugging" menu item to run the project. - The project will start in the browser, and you'll see the default ASP.NET Core 2.1 page.
That's it! You've successfully created a new project in ASP.NET Core 2.1. You can now start building your application by adding controllers, views, models, and other features as needed.