You are on page 1of 7

CT071-3-3-DDAC Get started with ASP.

NET Core and Visual Studio

Lab 1.4 – Get started with ASP.NET Core and Visual Studio
Estimated usage time: 30 minutes

This tutorial teaches ASP.NET Core MVC web development with controllers and views. If you're new to
ASP.NET Core web development, consider the Razor Pages version of this tutorial, which provides an
easier starting point. This is the first tutorial of a series that teaches ASP.NET Core MVC web development
with controllers and views.

Prerequisites
• Visual Studio 2022 or above with the following workloads:
o ASP.NET and web development
o .NET Core cross-platform development
• .NET 6.0 SDK or later.

a. Create Web App


(Estimated Total Time Used: 30 minutes)

1. From Visual Studio 2022, select Create a new project.

Level 3 Asia Pacific University of Technology & Innovation Page 1 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

2. Complete the Create a new project dialog:


• At the three columns, first choose C#, then choose All platforms and lastly choose Web.
• Then, in the bottom pane, tap ASP.NET Core Web App (Model-View-Controller)

• Tap Next

Level 3 Asia Pacific University of Technology & Innovation Page 2 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

3. Complete the Configure your new project dialog:

• Name the project as "MVC_APU_FlowerShop2023" (It's important to name the project "
MVC_APU_FlowerShop2023" so when you copy code, the namespace will match.)

• Tap Next

Level 3 Asia Pacific University of Technology & Innovation Page 3 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

4. Complete the Additional Information dialog:

• In the Target Framework selector drop-down box select .NET 7.0 (Standard Term Support)
• In the Authentication Type selector drop-down box select None
• Check the Configure for HTTPS
• Uncheck the Enable Docker

• Lastly, tap Create.

NOTE:
Visual Studio used a default template for the MVC project you just created. You have a working app
right now by entering a project name and selecting a few options. This is a basic starter project, and
it's a good place to start.

Tap F5 to run the app in debug mode or Ctrl-F5 in non-debug mode.

Level 3 Asia Pacific University of Technology & Innovation Page 4 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

Level 3 Asia Pacific University of Technology & Innovation Page 5 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

The default template gives you working Home and Privacy links. The browser image above doesn't
show these links. Depending on the size of your browser, you might need to click the navigation icon
to show them.

If you were running in debug mode, tap Shift-F5 to stop debugging.

==================================================================================

Notes:
• Visual Studio starts IIS Express and runs your app. Notice that the address bar
shows localhost:port# and not something like example.com. That's because localhost is the standard
hostname for your local computer. When Visual Studio creates a web project, a random port is used
for the web server. In the image above, the port number is 5000. The URL in the browser
shows localhost:5000. When you run the app, you'll see a different port number.
• Launching the app with Ctrl+F5 (non-debug mode) allows you to make code changes, save the file,
refresh the browser, and see the code changes. Many developers prefer to use non-debug mode to
quickly launch the app and view changes.

Level 3 Asia Pacific University of Technology & Innovation Page 6 of 7


CT071-3-3-DDAC Get started with ASP.NET Core and Visual Studio

• You can launch the app in debug or non-debug mode from the Debug menu item:

Debug mode Non-Debug mode

Summary:
• We have learnt how to create a simple ASP .Net Core Web Application in Visual Studio.

Level 3 Asia Pacific University of Technology & Innovation Page 7 of 7

You might also like