.NET CORE self contained application deployment. Why RID needs to be Known when .NET Core is cross platform

in a .NET Core self contained application ... We need to specify runtime (RIDs) in project.json we want our application to publish against... Why is that so? .NET Core is cross platform and it should not matter to what platform or operating system we are deploying our application to. isn't it?

enter image description here

Jon Skeet
people
quotationmark

Precisely because it's self-contained... it contains the whole of .NET Core, or at least as much as is required to run your application. While .NET Core is cross-platform, that doesn't mean that you can use the Linux x64 CLR binary on a Windows 10 IoT ARM machine, for example. Likewise your application may have dependencies on native libraries, which will vary by platform... it's not "one-binary-fits-all".

Instead, you say which platforms you want to build for, and you get a copy of your application for each of those platforms, complete with the runtime and libraries for that platform.

It sounds like what you want is a portable app instead of a self-contained app - at which point you're relying on the version of .NET Core which is already on the target machine, which will depend on the platform of that machine.

See the .NET Core Application Deployment article for more details on the differences between self-contained applications and portable ones.

people

See more on this question at Stackoverflow