Skip to main content

Command Palette

Search for a command to run...

ASP.NET Core 7.0 MVC on Replit

Published
1 min read
M

Mohamad's interest is in Programming (Mobile, Web, Database and Machine Learning). He is studying at the Center For Artificial Intelligence Technology (CAIT), Universiti Kebangsaan Malaysia (UKM).

Step 1: Create a New Replit Project

  1. Go to https://replit.com

  2. Sign in or create an account.

  3. Click "Create"

  4. In the "From Template" section, choose C# (.NET)

  5. Give your project a name (e.g., dotnetmvc)

  6. Click "Create Repl"

Delete:

  • main.cs

  • main.csproj

Step 2: Configure .replit File

Replace the contents of .replit with the following:

run = "dotnet watch run --urls=http://0.0.0.0:8080"

hidden = ["bin", "obj"]
modules = ["dotnet-7.0"]

[env]
DOTNET_NOLOGO = "1"
DOTNET_CLI_TELEMETRY_OPTOUT = "1"
DOTNET_CLI_HOME = "$XDG_CACHE_HOME"

[gitHubImport]
requiredFiles = [".replit", "replit.nix"]

[nix]
channel = "stable-24_05"

[[ports]]
localPort = 8080
externalPort = 80

Step 3: Initialize an ASP.NET Core MVC Project at Root

In the Replit shell, run:

dotnet new mvc -o .

Step 4: Restore & Run the App

Run:

dotnet restore
dotnet watch run --urls=http://0.0.0.0:8080

Click the "Open in new tab" button or navigate to the provided URL.

You should see the default ASP.NET MVC home page.