After finishing your application, you may want to deploy your bot to a
remote location such as a Virtual Private Server (VPS) or another
computer so you can keep the bot up and running 24/7.
For small-medium scaled bots, a cheap VPS (~$5) might be sufficient
enough. Here is a list of recommended VPS provider.
[!NOTE]
This section only covers the very basics of .NET Core deployment.
To learn more about .NET Core deployment,
visit .NET Core application deployment by Microsoft.
When redistributing the application - whether for deployment on a
remote machine or for sharing with another user - you may want to
publish the application; in other words, to create a
self-contained package without installing the dependencies
and the runtime on the target platform.
To deploy a framework-dependent package (i.e. files to be used on a
remote machine with the dotnet
command), simply publish
the package with:
dotnet publish -c Release
This will create a package with the least dependencies
included with the application; however, the remote machine
must have dotnet
runtime installed before the remote could run the
program.
[!TIP]
Do not know how to run a .NET Core application with
thedotnet
runtime? Navigate to the folder of the program
(typically under$projFolder/bin/Release
) and
enterdotnet program.dll
whereprogram.dll
is your compiled
binaries.
To deploy a self-contained package (i.e. files to be used on a remote
machine without the dotnet
runtime), publish with a specific
Runtime ID with the -r
switch.
This will create a package with dependencies compiled for the target
platform, meaning that all the required dependencies will be included
with the program. This will result in larger package size;
however, that means the copy of the runtime that can be run
natively on the target platform.
For example, the following command will create a Windows
executable (.exe
) that is ready to be executed on any
Windows 10 x64 based machine:
dotnet publish -c Release -r win10-x64