5

In the build settings, there is something called "Target Operating System" which lists

Android
iOS
Windows
MacOS
TvOS

In the publish settings there is something called "Target runtime" which lists

windows-x86
windows-x64
linux-x86
linux-x64
osx-x64
...

I can specify some inconsistent settings, such as TargetOS: Android, Target runtime: windows-x64 and still the publish will produce a windows-x64 executable. What is the purpose of TargetOS then?

Furthermore if I specify "Version of the target operating system: Windows 10.xxx", the publish folder will contain a new .dll called "Microsoft.Windows.SDK.NET.dll" which is about 20MiB, but which does not exist if I specify Windows 8, so why does the SDK .dll exists only when targeting Windows 10 or 11?

Alessandro
  • 97
  • 6
  • 1
    They just picked easy to identify terms. For a good reason, picking the correct architecture has been a huge problem in previous VS versions. Too few programmers understood the consequences of changing the solution platform and selecting things like "AnyCPU" and "Prefer 32-bit". The Windows 10.xxx selection should be used for projects that target UWP or Windows.AppSDK, the kind that are published through the Store. Support for UWP used to be integrated in the CLR but it was removed again. UWP is dead, bit of a secret. – Hans Passant May 18 '23 at 12:59

1 Answers1

0

Manipulating the "Target OS" (and "Target OS version") will actually modify the projects TargetFramework setting (stored in the .csproj) to corresponding target framework moniker (TFM). You should not consider it as final setting but as "default" one (i.e. if you don't specify one when publishing for example via CLI using dotnet publish or MSBuild this one will be used).

Check out also:

Guru Stron
  • 102,774
  • 10
  • 95
  • 132