Description
File-based apps are currently supported by the dotnet run
, dotnet restore
, and dotnet build
commands. We should consider supporting them with dotnet publish
so that ready-to-deploy assets can be easily produced by file-based apps.
This was asked on the socials: https://bsky.app/profile/normj.bsky.social/post/3lqb44uqms225
If we do consider this, we should strongly consider changing the defaults compared to project-based apps given this is a wholly new scenario and we get to decide a new default experience without needing to consider breaking changes (as long as they map to the project equivalent when dotnet project convert
is run), e.g.:
- Default to self-contained publish
- Default to single-file publish
- Defaulting to trimmed or native AOT is likely far too limiting given the current state of the ecosystem but these can be opted into easily with the property directive, i.e.
#:property PublishAot true
Doing this would make creating native AOT command line utils from C# extremely simple, requiring only a single .cs file with the #:property PublishAot true
directive, and execution of dotnet publish app.cs
.