sdk: NativeAOT publish for DLL does not set automatically RID

I was have following setup. DLL project which I publish as NativeAOT. I have to publish it dotnet publish -r win-x64 --self-contained otherwise project does not pickup nor current RID of my dev machine, not the fact that application is self-contained (NativeAOT). It’s most likely issue in SDK

  • dotnet publish want me specify RID
  • dotnet publish -r win-x64 use WinForms references during build, but do not propagate them for publish to ILC
  • dotnet publish -r win-x64 --self-contained works, but self-contained switch is misleading probably and undo a lot of tooling work in recent releases around NativeAOT

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 28 (18 by maintainers)

Most upvoted comments

in fact it was like that during part of 7.0.100, and it broke a lot of people.

Were those people using PublishAot=true? This issue is specific to NativeAOT, where RID and SelfContained are always required during the publish regardless of OutputType. The proposed fix does not affect anything else.

If most (or all) of the PublishAot=true cases must imply SelfContained=true ignoring the project OutputType, then this should be fine: https://github.com/am11/sdk/commit/dc23244c6a5fd0bddbd24ebab895402be1bc8f0f (props are still overridable if someone really needs SelfContained=false).