You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
As far as I understand I am able to implement platform-specific logic based on the defined target frameworks.
The goal I am trying to achieve is to create a cross-platform library that is able to provide a USB communication layer for Windows, Linux and Android.
Implementing the Android part was easy because there is an existing TFM, in my case I used monodroid9.0, and I added a condition like the following in the csproj file.
But unfortunately, there is not a specific separation between Windows and Linux based on the available TFMs. Even .net5.0 has not specific TFMs for Linux.
I also found no informations why thats a case but I can imagine that its hard to find a common API for linux operation system?
I also looked up some projects from the dotnet runtime but I found no good solution so far.
After some further investigations it seems I can separat Windows and Linux logic with the RuntimeInformation.IsOSPlatform but this would result in a lot of IFELSE statements.
Would it be possible to create some kind of "custom" TFM, so I am able to split the logic like I can do with Android?
A nice result would be to structure it like this in the csproj.
Hello.
As far as I understand I am able to implement platform-specific logic based on the defined target frameworks.
The goal I am trying to achieve is to create a cross-platform library that is able to provide a USB communication layer for Windows, Linux and Android.
Implementing the Android part was easy because there is an existing TFM, in my case I used
monodroid9.0
, and I added a condition like the following in thecsproj
file.But unfortunately, there is not a specific separation between Windows and Linux based on the available TFMs. Even
.net5.0
has not specificTFMs
for Linux.I also found no informations why thats a case but I can imagine that its hard to find a common API for linux operation system?
I also looked up some projects from the dotnet runtime but I found no good solution so far.
After some further investigations it seems I can separat Windows and Linux logic with the
RuntimeInformation.IsOSPlatform
but this would result in a lot ofIF
ELSE
statements.Would it be possible to create some kind of "custom" TFM, so I am able to split the logic like I can do with
Android
?A nice result would be to structure it like this in the
csproj
.Thank you in advance. 😊
The text was updated successfully, but these errors were encountered: