dotnet publish should accept a --single-file option to be translated to -p:PublishSingleFile=True.
I agree completely that this option should exist.
@livarcocc given that this is a relatively high-profile feature for 3.0, what's the chance this would meet the P9 bar? It would be a very small change, but one that would bring visibility to the feature and improved UX.
@peterhuene do we need similar switches for trimming and the linker?
I am supportive of making the change and taking it to Steve for approval.
I think adding those as well would make sense. It's just as easy to add one as three.
Without an incremental clean for publish, I don't think we should rush this into 3.0. It does not work to switch between these in different invocations.
This came up in the original design review: https://github.com/dotnet/designs/pull/52#discussion_r255150038
I would prefer to design an incremental cleaning mechanism for publish, and target a release where both of these can land, and in the meantime, recommend setting these in the project, using configurations where appropriate to have different options that can be chosen on the command line.
cc @rainersigwald
Now that the .NET Core SDK imports publish profiles (and at the appropriate time), perhaps we should steer users towards that as the place to put these publish-specific properties?
I would prefer to design an incremental cleaning mechanism for publish
This is already helpful when using non-self-contained RID specific publish..
e.g. Desktop app using app host customisation (icon) - dotnet publish -r win-x86 (because 32bit-only native libs from hardware vendors will never go way) - "oh I don't want that much" - add --self-contained false and wonder why there is still so much in the folder.
However, I believe having CLI options is already useful for build authors since any -p: syntax is prone to typos that go undetected. Plus you get code completion.
Not sure what the plan to document this is going to be. The few blog posts out there use -p:.
Can you point me to blog posts with -p? I specifically asked to document project file and the posts I saw had that.
I don't want to encourage -p. Self contained is in the same boat and we've had many bugs with it.
The behavior of switching self-contained off leaving everything behind is, I think, a good-enough precedent to warrant moving forward with the new options before we implement proper incremental publishing, but I'm not strongly opinionated other than I'd like to get this implemented now for P9 if we decide to.
@livarcocc since you missed the discussion relating to this in stand-up this morning, what are your thoughts regarding Nick's concerns?
Me and @KathleenDollard just discussed this and due to the finality of this change (we can't really take it back) and the potential to lead to very confusing contents in your publish output, we would like to post-pone this change to 5.0, when we hopefully can address the publish incrementality issues.
We will pay attention to feedback meanwhile.
Can you point me to blog posts with -p
https://www.google.com/search?rls=en&q=%22p%3APublishSingleFile%3DTrue%22 returns a lot of results..
ad publish profiles: I've opend https://github.com/dotnet/templating/issues/1654 quite a while ago suggesting templates for publishing profiles. I didn't pursue it any further though.
But it could potentially help in these situations, => dotnet new publish-profile -n SingleFilePublish --type folder --self-contained false --single-file true -r win-x64
Most helpful comment
I think adding those as well would make sense. It's just as easy to add one as three.