I am developing a .NET6.0 console app in VisualStudio 2022. The app will run on Linux.
In project Properties/Application/General, there is a "Target OS" setting. The drop down list allows me to choose from the following OS':
There is no Linux option, so I set this to (None) and when publish the app with "Target runtime" in "Publish profile" as 'linux-x64':
...it will run on Linux no problem.
But since there is no Linux option in the drop down menu in application settings, hence my questions:
None
is correct for the Target OS
since it has nothing extra. All of the other target frameworks contain platform-specific features. (Like WPF
related Namespaces are under Windows
). Another way to look at it is None=Everywhere
What you might be interested in is setting the RuntimeIdentifier
or RuntimeIdentifiers
in your .csproj
.
For your case the following is probably what you'll want:
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
With this set, the compiler/Visual Studio will warn you about the usage of methods not available on one of the specified platforms. Console
has some that only work on Windows.