Install ASP.NET Core
This guide will walk you through the steps to install ASP.NET Core on your development machine. ASP.NET Core is a cross-platform, high-performance, open-source framework for building modern, cloud-based, internet-connected applications.
Prerequisites
Before you begin, ensure you have the latest version of the .NET SDK installed. You can download it from the official .NET download page.
Installation Steps
- Download the .NET SDK: Navigate to the official .NET download page and select the latest stable version. Choose the appropriate installer for your operating system (Windows, macOS, or Linux).
-
Run the Installer:
- Windows: Run the downloaded executable (`.exe`) file and follow the on-screen instructions.
- macOS: Run the downloaded package (`.pkg`) file and follow the on-screen instructions.
- Linux: Follow the instructions for your specific distribution on the official .NET Linux installation guide. Typically, this involves using your distribution's package manager.
-
Verify Installation: After the installation is complete, open a new command prompt or terminal window and run the following command to verify that the .NET SDK has been installed correctly:
dotnet --version
Creating Your First ASP.NET Core Application
Once the .NET SDK is installed, you can create and run your first ASP.NET Core application using the .NET CLI. Let's create a simple Razor Pages application.
-
Create a new project directory:
mkdir MyRazorApp
cd MyRazorApp
-
Create a new Razor Pages project:
dotnet new razor
-
Run the application:
dotnet run
Open your web browser and navigate to the URL provided in the output of the dotnet run
command (usually https://localhost:5001
or http://localhost:5000
). You should see the default ASP.NET Core Razor Pages welcome page.
Platform-Specific Notes
Windows
The Windows installer includes everything you need to develop ASP.NET Core applications. You can also use Visual Studio, which has excellent built-in support for ASP.NET Core development.
rem Verify .NET SDK installation
dotnet --info
macOS
Ensure you have Xcode installed for full macOS development support. The .NET SDK for macOS can be installed via the official installer or Homebrew.
# Verify .NET SDK installation
dotnet --info
Linux
Installation on Linux typically involves adding a package repository and using your distribution's package manager (e.g., apt
for Debian/Ubuntu, dnf
for Fedora). Refer to the official documentation for detailed instructions for your specific distribution.
# Verify .NET SDK installation
dotnet --info
Next Steps
Congratulations! You have successfully installed ASP.NET Core. You can now explore the following resources to learn more: