First of all, in order to debug a .NET app for linux on a windows operating system, we will be using Windows Subsystem for Linux (WSL).
To install WSL, use the following command as an administrator:
wsl --install
and restart your machine.
Then install Ubuntu-22.04
using the following command:
wsl --install --distribution Ubuntu-22.04
The available distributions can be listed using the command:
wsl --list --online
We will be using Ubuntu-22.04
, since that is one of the available stacks for SAP BTP, which can be listed using the command:
cf stacks
To build OneDealer for linux, you will have to change the following properties in Directory.build.props
:
TargetFramework
: from net6.0-windows
to net6.0
RuntimeIdentifier
: from win-x64
to linux-x64
and load the solution again.
Then you will have to use the WSL
launch profile to debug the application on the linux installation, which has some limitations in the diagnostic tools.
Using the #if WINDOWS
preprocessor directive, we can toggle sections of code to be included, depending on whether the TargetFramework
is net6.0-windows
or net6.0
.
To publish the application for linux, in addition to changing the properties in Directory.build.props
, you will have to use the publish profile FileSystem-Linux.pubxml
.
Add Comment