Coder Social home page Coder Social logo

fody's Introduction

Icon

Extensible tool for weaving .net assemblies

Introduction

Manipulating the IL of an assembly as part of a build requires a significant amount of plumbing code. This plumbing code involves knowledge of both the MSBuild and Visual Studio APIs. Fody attempts to eliminate that plumbing code through an extensible add-in model.

The nuget package

https://nuget.org/packages/Fody/

Why?

This technique of "weaving" in new instructions is fantastically powerful. You can turn simple public properties into full INotifyPropertyChanged implementations, add checks for null arguments, add Git hashes to your Assemblies, even make all your string comparisons case insensitive.

Note: NotifyPropertyWeaver

Users of the NotifyPropertyWeaver extension who are migrating to Fody will want to use NuGet to Install the PropertyChanged.Fody package along with Fody itself to get the same functionality as before. This is because Fody is a general purpose weaver with plugins while NotifyPropertyWeaver was specific to one scenario. That scenario now lives in the PropertyChanged addin. See Converting from NotifyPropertyWeaver for more information.

The plumbing tasks Fody handles

  • Injection of the MSBuild task into the build pipeline
  • Resolving the location of the assembly and pdb
  • Abstracts the complexities of logging to MSBuild
  • Reads the assembly and pdb into the Mono.Cecil object model
  • Re-applying the strong name if necessary
  • Saving the assembly and pdb

Fody Uses Mono.Cecil and an add-in based approach to modifying the IL of .net assemblies at compile time.

  • No install required to build
  • No attributes required
  • No references required
  • Supports .net 3.5, .net 4, .net 4.5, Silverlight 4, Silverlight 5, Windows Phone 7, Windows Phone 8, Metro on Windows 8, Mono, MonoTouch, MonoDroid and PCL

Usage

See SampleUsage for an introduction on using Fody.

Naming

The name "Fody" comes from the small birds that belong to the weaver family Ploceidae.

Tools and Products Used

Samples

  • BasicFodyAddin A simple project meant to illustrate how to build an addin.
  • FodyAddinSamples is a single solution that contains a working copy of every fody addin.

Addins List

  • Anotar Simplifies logging through a static class and some IL manipulation.
  • AsyncErrorHandler Integrates error handling into async and TPL code.
  • BasicFodyAddin A simple project meant to illustrate how to build an addin.
  • Caseless Change string comparisons to be case insensitive.
  • Catel For transforming automatic properties into Catel properties.
  • Commander Injects ICommand properties and implementations for use in MVVM applications.
  • Costura For embedding references as resources.
  • DependencyInjection automatic dependency injection for Ninject, Autofac and Spring.
  • EmptyConstructor Adds an empty constructor to classes even if a non empty one is defined.
  • EnableFaking Allows faking your types without writing interfaces for testing purposes only.
  • [Equals] (https://github.com/Fody/Equals) Generate Equals, GetHashCode and operators methods from properties.
  • ExtraConstraints Facilitates adding constraints for Enum and Delegate to types and methods.
  • Fielder Converts public fields to public properties.
  • Freezable Implements the Freezable pattern.
  • InfoOf Provides methodof, propertyof and fieldof equivalents of typeof.
  • Ionad Replaces static method calls.
  • Janitor Simplifies the implementation of IDisposable.
  • JetBrainsAnnotations Modifies an assembly so you can leverage JetBrains Annotations but don't need to deploy JetBrainsAnnotations.dll.
  • MethodCache Caches return values of methods decorated with a CacheAttribute.
  • MethodDecorator Decorate arbitrary methods to run code before and after invocation.
  • MethodTimer Injects method timing code.
  • Mixins A mixin is a class that provides a certain functionality to be inherited or just reused by a subclass.
  • ModuleInit Adds a module initializer to an assembly.
  • Mutable Use this addin for F# to make setters for union types and eliminate need for CLIMutable attribute for records.
  • NullGuard Adds null argument checks to an assembly
  • Obsolete Helps keep usages of ObsoleteAttribute consistent.
  • PropertyChanged Injects INotifyPropertyChanged code into properties.
  • PropertyChanging Injects INotifyPropertyChanging code into properties.
  • Publicize Converts non-public members to public hidden members.
  • RemoveReference Facilitates removing references in a compiled assembly during a build.
  • Resourcer Simplifies reading embedded resources from an Assembly.
  • Scalpel Strips tests from an assembly.
  • Spring Spring constructor configuration.
  • Stamp Stamps an assembly with git data.
  • Stiletto Compile-time static analysis and optimization for the Stiletto IoC library.
  • ToString Generate ToString method from public properties.
  • Usable Adds using statements for local variables that have been created, and implement IDisposable.
  • Validar Injects IDataErrorInfo or INotifyDataErrorInfo code into a class at compile time.
  • Visualize Adds debugger attributes to help visualize objects.
  • Virtuosity Change all members to virtual.

Icon

Bird designed by Marco Hernandez from The Noun Project

More Info

With thanks to

Resharper from Jetbrains

http://www.jetbrains.com/resharper/

Resharper.png

TeamCity from Jetbrains

http://www.jetbrains.com/TeamCity/

TeamCity.png

fody's People

Contributors

simoncropp avatar distantcam avatar shiftkey avatar anaisbetts avatar shanselman avatar amanda-mitchell avatar rjasica avatar

Watchers

Doru Cioclea avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.