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.

There might still be some differences in the behaviour of the application during deployment on a SAP BTP or another real linux environment, since the underlying filesystem is still NTFS which is case-insensitive on the local machine, while it will probably be running on a linux case-sensitive filesystem on the server.


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.

  • No labels
Write a comment…