Skip to main content

Command Palette

Search for a command to run...

DotNet Core App

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).

[1] Create C# Project

Start by creating a new C# project in Replit:

  • Go to https://replit.com and sign in.

  • Click on the “Create” button or go to the “New Repl” page.

  • In the language selection menu, choose the C# template (this sets up the environment with basic C# tooling).

  • In the project name field, type a name like aspdotnet1 (or any name you prefer).

  • Click the “Create Repl” or “Create App” button.

This initializes a basic C# environment.

[2] Explore basic files

.replit

main.csproj

main.cs

[2.1] .replit files

entrypoint = "main.cs"

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"

[deployment]
run = ["dotnet", "run"]
deploymentTarget = "cloudrun"

[2.2] main.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp7.0</TargetFramework>
    <StartupObject>Program</StartupObject>
  </PropertyGroup>

</Project>

[2.3] main.cs

using System;

class Program {
  public static void Main (string[] args) {
    Console.WriteLine ("Hello World");
  }
}

[3] Run

Click the RUN button.

Open the Console window.