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