.NET framework

Installation


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
    

How to run?


Very short and simple introduction of .NET framework to create stand-alone app, for multiple platforms like Linux and Windows.

  1. Create a new directory and navigate into it.
  2. Inside the folder, initialize the .net project.
  3. Edit the c# script. Program.cs
  4. Run the sample program.
  5. Configure the application settings. app1.csproj
  6. Run the app, the executable should be ./bin/Debug/net5.0/app1.
  7. 
    #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
        

References