Deploying .NET Application

Kevin FOO
1 min readFeb 6, 2025

--

After the application successfully run in local development environment shown in this article, within the application directory compile and publish the dll.

My target instance is AWS EC2 t4g which is an ARM64 version.

dotnet publish -c Release -r linux-arm64 -o ~/Desktop/dotnet-clipboard

Copy app.db to ~/Desktop/dotnet-clipboard/ because in the EC2 only .NET runtime will be installed instead of SDK. Zip the folder and scp it to the server

tar -czvf dotnet-clipboard.tgz dotnet-clipboard

scp dotnet-clipboard.tgz ubuntu@1.2.3.4:~

In the server, install .NET runtime

wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

sudo apt update

sudo apt install -y dotnet-runtime-8.0 aspnetcore-runtime-8.0

Unzip dotnet-clipboard.tgz

cd /var/www

# move tgz file to www directory
mv ~/dotnet-clipboard.tgz .

# unzip tgz file
sudo tar -xzvf dotnet-clipboard.tgz

# set the ownership
sudo chown -R ubuntu:ubuntu dotnet-clipboard

# run
cd dotnet-clipboard
dotnet DotNetClipboard.dll

< Back to all the stories I had written

--

--

Kevin FOO
Kevin FOO

Written by Kevin FOO

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.

No responses yet