出来的单文件还有一些dll没打包进去
只需要加一个:
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<PublishSingleFile>true</PublishSingleFile>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
</PropertyGroup>
再次打包:
包成了154M 应该是打包进去了。测试一下
成功运行!!!