鸟语天空
将所有DLL打包到EXE中
post by:追风剑情 2022-3-9 10:58

参考 https://www.cnblogs.com/zhuzhi0819/p/12931691.html

需要安装 Costura.Fody

11111.png

输入安装命令 PM> Install-Package Costura.Fody -Version 1.6.2

222222.png

安装好 Costura.Fody 后,编译项目。此时生成的exe就可以独立运行了。

如果在编译过程中报以下警告:
MSBUILD : warning FodyPackageReference: Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets

解决方案:打开.csproj文件,在IncludeAssets中添加compile

<PackageReference Include="Costura.Fody">
  <Version>5.7.0</Version>
  <IncludeAssets>runtime; compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  <PrivateAssets>all</PrivateAssets>
</PackageReference>
评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容