2. About meAbout me
Tomasz PluskiewiczTomasz Pluskiewicz
WrocławWrocław
MakoLab S.A.MakoLab S.A.
@tpluscode@tpluscode
3. About code weavingAbout code weaving
About FodyAbout Fody
ExamplesExamples
QuestionsQuestions
AgendaAgenda
4. „„Generate” additional code to:Generate” additional code to:
Add boilerplate code automaticallyAdd boilerplate code automatically
Implement Aspect-Oriented ProgrammingImplement Aspect-Oriented Programming
ObfuscationObfuscation
Build killer APIsBuild killer APIs
What is code weaving?What is code weaving?
5. Source code weavingSource code weaving
Compile-time weavingCompile-time weaving
Runtime weavingRuntime weaving
How can I weave?How can I weave?
7. Simple but less flexibileSimple but less flexibile
Requires runtime reference to PostSharpRequires runtime reference to PostSharp
Requires Visual Studio extensionRequires Visual Studio extension
Aspects in embedded resourcesAspects in embedded resources
Full functionality is not freeFull functionality is not free
PostSharpPostSharp
8. IL weaving (with Cecil)IL weaving (with Cecil)
ILIL isis difficultdifficult
Need to update PDBsNeed to update PDBs
MSBuild integrationMSBuild integration
9. Fodies are small passerine
birds belonging to the genus
Foudia in the weaver family
Ploceidae
- wikipedia/Fody
14. Emitting IL is still required (duh!)Emitting IL is still required (duh!)
However FodyHowever Fody
Injects weavers to build pipelineInjects weavers to build pipeline
Loads assembliesLoads assemblies
Rewrites PDBsRewrites PDBs
Reapplies strong nameReapplies strong name
Writes to MSBuild build logWrites to MSBuild build log
Custom weavingCustom weaving
15. Assembly with .Fody suffixAssembly with .Fody suffix
ILMerge referencesILMerge references
Pulic ModuleWeaver classPulic ModuleWeaver class
Mutltiple deployment optionsMutltiple deployment options
In-solutionIn-solution
$(SolutionDir)/Tools
NuGet packageNuGet package
Learn fromLearn from
existing weavers (example follows)existing weavers (example follows)
Fody wikiFody wiki
Writing a weaverWriting a weaver
17. Don’t use Visual Studio pluginDon’t use Visual Studio plugin
Weaver order sometimes does matterWeaver order sometimes does matter
Debugging unavailable codeDebugging unavailable code
LogInfo requires detailed MSBuild outputLogInfo requires detailed MSBuild output
Tools -> Projects and Solutions -> Build andTools -> Projects and Solutions -> Build and
RunRun
Remember to update Fody packageRemember to update Fody package
GotchasGotchas