.NET 5发布成单个exe文件,需要使用参数:
p:IncludeNativeLibrariesForSelfExtract=true
使用命令:
dotnet publish -c Release -o publish -p:PublishReadyToRun=true -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true -p:IncludeNativeLibrariesForSelfExtract=true
或者.csproj文件中
Exe net5.0 true win-x64 x64 true