ASP.NET Core 7.0 MVC on Replit
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
Go to https://replit.com
Sign in or create an account.
Click "Create"
In the "From Template" section, choose C# (.NET)
Give your project a name (e.g.,
dotnetmvc)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.