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
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
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
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.
dir # just a sanity check
sudo chmod +x helloworld
This will make your executable executable and then run it.