Fody is a .NET Assembly bundler, I mean modifying .NET assemblies on the intermediate language (MSIL) level, after the build process. This allows bundling all your small
.dll files into one. So if we deploy stand-alone applications, only have to give a single file to users. All we need to do is install the NuGet package:
And we are done, Nothing else to do just build the project and check out the output. we’ll see a bunch of dll files as before because input files are not deleted automatically. But if you check the executable – it is much larger now than before. And now we can move it away from the rest of libraries files and it will work. Apart from .exe file if any dependency files like config copy those as well.
Package installation will create
FodyWeavers.xml file in the root of your solution – put project settings there. And needed to exclude debug symbols from the resulting file. Here is how
FodyWeavers.xml look like:
<?xml version="1.0" encoding="utf-8" ?> <Weavers> <Costura IncludeDebugSymbols='false' /> </Weavers>
How it works
This Task performs the following changes
- Take all assemblies (and pdbs) that have been marked as “Copy Local” and embed them as resources in the target assembly.
- Injects the following code into the module initializer of the target assembly. This code will be called when the assembly is loaded into memory
There are some settings available. Fody is designed as an extendable platform with a long list of plugins. Check the details on