Search code examples
c#msbuildfodycompile-time-weaving

Using Fody and Ionad to replace static calls on external assemblies


I'm using Fody and Ionad to replace static calls to DateTime.Now as it is described in the documentation:

[StaticReplacement(typeof(DateTime))]
public static class DateTimeSubstitute
{
    public static IDateTime Current { get; set; }

    public static DateTime Now { get { return Current.Now; } }
}

This works fine for assemblies inside my project. However, I have external assemblies that are not referenced directly by my project, and I need to perform the same replacement, but on-demand...

How do I run Fody Ionide for a specific assembly (given a path?)


Solution

  • Fody does not currently support execution against non-project dlls. That is, you can only run it from within the current project and target the assembly of that current project