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 publishwant me specify RIDdotnet publish -r win-x64use WinForms references during build, but do not propagate them for publish to ILCdotnet publish -r win-x64 --self-containedworks, butself-containedswitch 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)
Were those people using
PublishAot=true? This issue is specific to NativeAOT, where RID and SelfContained are always required during the publish regardless ofOutputType. The proposed fix does not affect anything else.If most (or all) of the
PublishAot=truecases must implySelfContained=trueignoring the projectOutputType, then this should be fine: https://github.com/am11/sdk/commit/dc23244c6a5fd0bddbd24ebab895402be1bc8f0f (props are still overridable if someone really needs SelfContained=false).