Is it possible to upgrade from .NET 6 to 7?

Describe your feature request
I noticed dotnet version 6 is installed. Is it possible to upgrade to version 7? I tried some ‘apt’ commands but these failed.

What problem(s) would this feature solve?
I need the latest version because some nuget packages aren’t compatible only with version 7.

Explain what you were trying to do when you came across the problem leading to this feature request
Testing out your .NET template.

I will answer my own question:

  1. Start with the standard .NET 6.0 Replit Template
  2. Show hidden files
  3. Edit the replix.nix file
  4. Change to:
{ pkgs }: {
    deps = [
        pkgs.jq.bin
        pkgs.dotnet-sdk_7
        pkgs.omnisharp-roslyn
    ];
}
  1. Edit the csproj file and change to:
<Project Sdk="Microsoft.NET.Sdk">

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

</Project>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Important additions:
Because if you start with one of the standard Visual Studio templates, normally the solution resides in the parent folder and the C# project in a subfolder. You then need to add the ‘project’ parameter to the run command. Example:

run = "dotnet watch run --project YourProjectFolderName"

Running out of the box will fail because Webview does not work with localhost so you need to add the ‘urls’ parameter to the run command. Example (with above project parameter):

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

If you like to check if everything works in for example in a web.api project enter the following URL in the Webview url bar:

/swagger/index.html
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.