Closed jmhickman closed 1 year ago
In my experience, even specifying just --self-contained
(without -p:PublishSingleFile=true -p:PublishTrimmed=true
) is enough for executable to stop working.
https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/7.0/trim-all-assemblies
No plans at all. The library uses reflection by design as such it is unsuitable for trimmed applications. Consider using a newer library such as System.CommandLine instead.
@eiriktsarpalis
Maybe just adding some attributes on some specific places would suffice to inform the trimmer that it should keep certain types around for runtime reflection.
Another valuable thing would be to explore the problem and give guidelines in the README file or on the documentation page of how to circumvent the problem when deploying their app to production.
E.g. telling people that adding <TrimMode>partial</TrimMode>
to their .fsproj file would apparently make their --self-contained
apps on .net 7.0 work just like they did on .net 6.0.
Description
I have a small app that uses Argu. When I built it against .net 7 with trimming enabled, the argument configuration seems to break, showing only a generic
--help
item.dotnet publish -p:PublishSingleFile=true -p:PublishTrimmed=true -r:win-x64 --self-contained -c release
This works fine in .net 6, but I'm supposing that changes to the trimming mechanism in .net 7 has made it more aggressive.
In order to figure out if I can continue to use Argu, I need to know if this is a breaking change that's just inherent to how Argu works, or if trimming can be supported with some (hopefully) minor tweak.
Not treating this as a bug, since there was no assertion that Argu worked with .net 7 and trimming, etc.
Thanks.