VS2015使用Costura.Fody将dll打包到exe

一、Costura.Fody是什么?
Costura.Fody是一个Fody框架下的插件,可通过Nuget安装到VS工程中。

安装之后,就可以将项目所依赖的DLL(甚至PDB)文件全部打包到EXE文件里。

二、使用步骤
1.安装Fody
步奏如下:

可以在VS的程序包管理器控制台中输入Install-Package Fody -Version 4.2.1来安装4.2.1版本的Fody

2.安装Costura.Fody
步奏如下:

在VS的程序包管理器控制台中输入Install-Package Costura.Fody -Version 3.3.3来安装3.3.3版本的Costura.Fody。

3.安装完成,重新生成解决方案

错误提示如下:
Fody: No configuration entry found for the installed weaver Costura. This weaver will be skipped. You may want to add this weaver to your FodyWeavers.xml

4.修改FodyWeavers.xml

å¨è¿éæå¥å¾çæè¿°

修改FodyWeavers.xml内容为如下:

<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Costura />
</Weavers>

猜你喜欢

转载自blog.csdn.net/u012842630/article/details/117233577