The NuGet package contains appropriate libraries but these will
be specific to the platform on which you are running. To deploy to
Linux you will need to do a command line publish.
.NET Installation. Linux does not come with the .NET
runtime pre-installed.
If you have not installed it then you will get an error when you
try and run the executable. Something similar to this.
You must install .NET to run this
application.
App: /home/pcuser/helloworld/helloworld
Architecture: x64
App host version: 6.0.22
.NET location: Not found
Details of how to install the runtime may be found here.
You only need the runtime not the SDK. The SDK is the first part
mentioned but not the part you are looking for.
|
Open a command line and then navigate to the location of your
project.
Here we will assume that you have a project called
'hellowiorld", that you have a WSL Linux installation called
"Ubuntu" and a Linux user called "pcuser". Run the following to
deploy to your Linux installation.
dotnet publish helloworld.csproj -r linux-x64 --self-contained false --output \\wsl.localhost\Ubuntu\home\pcuser\helloworld
Open up a bash shell by clicking in the Windows task bar search
box and typing "bash". Enter the following.
cd ~/helloworld
dir # just a sanity check
sudo chmod +x helloworld
~/helloworld/helloworld
This will make your executable executable and then run it.
|