C# projects don't work

Problem description

when I try to run mc C# project, it genuinely just doesnt work.
THIS IS MY Program.cs FILE

using System;

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

THIS IS MY Program.csproj FILE

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <StartupObject>HelloWorld.Program</StartupObject>
  </PropertyGroup>

</Project>

THIS IS MY .replit FILE

entrypoint = "Program.cs"

hidden = ["bin", "obj"]
modules = ["dotnet-7.0:v3-20231201-3b22c78"]

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

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

[nix]
channel = "stable-23_11"

[deployment]
run = "/nix/store/vlld2zn615vzl0y7gmygzjmbmvq9p5gi-dotnet-sdk-7.0.406/dotnet run --framework netcoreapp3.1"

Expected behavior

console should print “Hello World!”

Actual behavior

nothing, then 20> seconds later I get an error, (chat gpt was unable to solve the issue and referred me to the support pages)

Steps to reproduce

run any C# program, it just doesnt work

Browser

Chrome

OS

MacOS

Device if mobile

N/A

Plan

free tier

Please provide the error message.

2 Likes
You must install or update .NET to run this application.

App: /home/runner/Ctest1/bin/Debug/netcoreapp3.1/Program
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
.NET location: /nix/store/vlld2zn615vzl0y7gmygzjmbmvq9p5gi-dotnet-sdk-7.0.406

The following frameworks were found:
  7.0.16 at [/nix/store/vlld2zn615vzl0y7gmygzjmbmvq9p5gi-dotnet-sdk-7.0.406/shared/Microsoft.NETCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.20.04-x64

@OwenGamer5 If you make a new Repl, select the C# template, and run that – do you get the “Hello World” back? The C# is a little slow for free tier CPU so you may need to wait 15 seconds or so, but hopefully no errors.