Install the SDK

winget install Microsoft.DotNet.SDK.7

Install the .NET Desktop Runtime

winget install Microsoft.DotNet.DesktopRuntime.7

Install the ASP.NET Core Runtime

winget install Microsoft.DotNet.AspNetCore.7

Install the .NET Runtime

winget install Microsoft.DotNet.Runtime.7

Build On Windows: Run on Ubuntu

Windows:
*******
dotnet new console -n test
The template "Console App" was created successfully.
cd test
-----------------
dotnet build
MSBuild version 17.5.0+6f08c67f3 for .NET
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
-----------------

dotnet publish -c release -r ubuntu.16.04-x64 --self-contained
MSBuild version 17.5.0+6f08c67f3 for .NET
  Determining projects to restore...
  Restored E:\work\myDotNet\test\test.csproj (in 7.33 sec).
  test -> E:\work\myDotNet\test\bin\release\net7.0\ubuntu.20.04-x64\test.dll
  test -> E:\work\myDotNet\test\bin\release\net7.0\ubuntu.20.04-x64\publish\
----------------
Open Linux:
**********
cd ./obj/release/net7.0/ubuntu.20.04-x64/
./test
Hello, World!