NativeAOT publish for DLL does not set automatically RID
See original GitHub issueI 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 RIDdotnet publish -r win-x64
use WinForms references during build, but do not propagate them for publish to ILCdotnet publish -r win-x64 --self-contained
works, butself-contained
switch is misleading probably and undo a lot of tooling work in recent releases around NativeAOT
Issue Analytics
- State:
- Created 8 months ago
- Comments:28 (18 by maintainers)
Top Results From Across the Web
Native AOT deployment overview - .NET
Publishing your app as native AOT produces an app that's self-contained and that has been ahead-of-time (AOT) compiled to native code.
Read more >Static libraries
When Native AOT building a dynamic library, this chore is performed automatically, because the .dll (or .so or .dylib) is built by the...
Read more >Automatic native and managed DLLs extracting from Nuget ...
The trick is to create a targets file that will handle the DLL ... 6) With only native libraries in my package, the...
Read more >[NET 7] NativeAOT-compiled static library is not exporting ...
I am trying to compile my managed code into a static library (.lib file on win-x64), so I can link against it from...
Read more >Dotnet build linux. The answer you're looking for is basically
Props file is never loaded. dll would be faster still, but you may need to dotnet publish and run the dll from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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=true
cases must implySelfContained=true
ignoring the projectOutputType
, then this should be fine: https://github.com/am11/sdk/commit/dc23244c6a5fd0bddbd24ebab895402be1bc8f0f (props are still overridable if someone really needs SelfContained=false).