wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0
sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-5.0
Very short and simple introduction of .NET framework to create stand-alone app, for multiple platforms like Linux and Windows.
Program.cs
app1.csproj
./bin/Debug/net5.0/app1
.
#1
mkdir app
cd app
#2
dotnet new console
#3
vim Program.cs
#4
dotnet build --runtime win10-x64
dotnet build -r linux-x64
dotnet build
dotnet run -r win10-x64
dotnet run -r linux-x64
dotnet run
#5
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
dotnet publish -f net5.0 -r win10-x64 --self-contained false
dotnet publish -f net5.0 -r linux-x64
dotnet publish
#6
.\bin\Debug\net5.0\win10-x64\app.exe
./bin/Debug/net5.0/linux-x64/app
./bin/Debug/net5.0/publish/app