Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tips: Using MySqlConnector + MySqlBackup.NET in CentOS (Linux) #1123

adriancs2 started this conversation in Show and tell
Discussion options

I'm one of the main contributor for MySqlBackup.NET project, that works on top of MySqlConnector to perform backup & restore of MySQL databases.

The following explained the idea of using MySqlConnector +MySqlBackup.NET in CentOS (Linux).

The idea is to build the project in .NET Core.

We can test this out with a simple Console App.

Starting by creating a .net core linux project:

01

Check the project properties, ensure the project is built with .NET Core framework:

02

Install Nuget Package of MySqlBackup.NET (with MySqlConnector):

03

Next, is to publish the project for .NET Core (Linux):

04

In above example, the Linux compiled binaries are located at:

\bin\Release\netcoreapp3.1\publish\linux-x64

Copy the DLL in above folder and paste it to your CentOS

At the CentOS, make sure that you have installed Dotnet runtime by following command:

sudo dnf install dotnet-sdk-<version>

For example:

sudo dnf install dotnet-sdk-3.1
sudo dnf install dotnet-sdk-5.0

Assume that you have copied your .NET Core DLL files at the following folder:

/home/<username>/testapp

Then you can test out your app with following command:

cd /home/admin/testapp
dotnet ConsoleApp.dll

Here is the sample source code for your referrence:

ConsoleApp2.zip

You must be logged in to vote

Replies: 2 comments

Comment options

I may have the exact command-line slightly wrong, but you should be able to run something like dotnet publish -p:PublishSingleFile=true -c Release --self-contained --arch x64 --os linux to produce a binary that can run without needing to install the .NET runtime on the target system.

See https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file for more info.

You must be logged in to vote
0 replies
Comment options

Publishing self-contained binary can also be done at Visual Studio GUI

05

Here is the example of how it looks like, there is only 1 single file:

06

Copy the compiled binary to CentOS

At the terminal, browse to the folder that contains the self-contained binary, for example:

cd /home/admin/testapp

Next, is to allow execution permission to the file:

sudo chmod 777 ConsoleApp2

Execute the app:

./ConsoleApp2 
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /