Unable to compile project due to Fody errors. Nothing with Fody (or any other code) has been changed


** This is an issue in Visual Studio 2013.

The error I'm getting is massive and mostly useless, but the crux of it is

Error   130 Fody: Could not load 'ModuleWeaver' from 'PropertyChanged.Fody, Version=, Culture=neutral, PublicKeyToken=null' due to ReflectionTypeLoadException.
It is possible you need to update the package.
System.IO.FileLoadException: Could not load file or assembly 'Mono.Cecil,     Version=, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its     dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Mono.Cecil, Version=, Culture=neutral, PublicKeyToken=0738eb9f132ed756'

Again since there have been no changes, I have no idea what it's problem is in general. The DLL it is looking for is sitting in the same place it has always been sitting.

Edit: apparently at this point it got tired of spitting out that error so it fabricated a new one

Error   42  The "Fody.WeavingTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Cecil, Version=, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
File name: 'Mono.Cecil, Version=, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
   at ExceptionExtensions.LogException(ILogger logger, Exception exception)
   at Processor.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\Processor.cs:line 56
   at Fody.WeavingTask.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\Fody\WeavingTask.cs:line 44
   at     Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

Edit 2:

Also, the error is allegedly taking place inside "Fody.targets" on line 50 which is


Edit 3:

I deleted all the files associated with Fody and Nuget redownloaded them during the build process. The error after that is the same as the 2nd error:

"Error   42  The "Fody.WeavingTask" task failed unexpectedly." 

Edit 4:

I really hope the dev of Fody sees this because we're at an absolute standstill until this is fixed. We can't "revert" back to when it was working because the current configuration IS when it was working.

asked on Stack Overflow Oct 1, 2015 by Justin • edited Oct 1, 2015 by Justin

6 Answers


It would seem that your error is actually in finding a class called ModuleWeaver. This class is part of the Fody package.

Just updating the package in nuget package manager with:

   update-package Fody -reinstall

Will probably fix it.

Failing that: make sure that your app.config file does not have incorrect redirects. Remove this section, remove all the redirects. Visual studio will typically add the necessary ones back.

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="" newVersion="" />

Try again, if that fails, try to find which dependent assembly is failing. You can write a one line command line app, or use LinqPad.

You can try LinqPad, if you don't use it already, paste this.

Assembly.LoadFile("path to Fody");
Assembly.LoadFile("path to Mono.Cecil");

You should get an exception detailing the missing library.

answered on Stack Overflow Oct 2, 2015 by Jim • edited Oct 2, 2015 by Jim

If you are using git, running this from the command line:

git clean -xdf
answered on Stack Overflow Sep 28, 2017 by Paul Kiar

After trying all solutions I could find on the internet, the following worked for me:

  1. Close Visual Studio.
  2. Delete the Debug and Release folders in your PCL project and your {platform} project. For me these were located in something like MyPCLProjectName\bin\ and iOS\bin\iPhoneSimulator\.
  3. Edit your PCL and {platform} .csproj file and remove all <Import> tags, except for the one that starts <Import Project="$(MSBuildExtensionsPath32)\...
  4. Reopen Visual Studio.
  5. Restore the packages (this step may be done automatically when you reopen Visual Studio) - Solution Explorer > right-click solution > Restore NuGet Packages.
answered on Stack Overflow Aug 18, 2017 by jbyrd • edited Aug 24, 2017 by jbyrd

To debug such issues, you can use SysInternals Process Monitor.

The general approach is:

  1. run Process Monitor
  2. apply a filter to monitor you application only
  3. reproduce the issue
  4. look for missing DLLs. This part is a bit tricky, since

    1. a DLL might not be found several time ("Path not found")
    2. but finally be found ("Success")
    3. it might not be the DLL you're looking for but a dependency of that DLL

    So you need to find a DLL which was never found. And you don't want DLLs that were not found but then found in a subsequent attempt.

Well, that process can be quite time consuming, so I developed the tool Process Monitor Log Analyzer. With it, you should be able to find the culprit in less time.

  1. run Process Monitor
  2. apply a filter to monitor your application only
  3. reproduce the issue
  4. save the result as XML (keep all items, "Path not found" and "Success")
  5. open the XML in Log Analyzer
  6. from top to bottom, check the presence of DLLs. The tool will only show DLLs that are never found.

Disclaimer: I am the author of that free tool, if that didn't become clear from the text.

answered on Stack Overflow Oct 1, 2015 by Thomas Weller

Some of you getting similar errors might benefit from this info, which states that projects with different Fody versions cannot use the same NuGet packages folder (if I understood correctly): Installing multiple versions of PropertyChanged breaks compilation

Reinstalling the Fody package in all projects also resolves the issue, but changing all to the same version might be easier.

answered on Stack Overflow Jul 24, 2017 by wezzix

I had a project that encountered this: my machine had Visual Studio 2017 installed, but I had recently also installed the Build Tools for Visual Studio 2019 as well for an unrelated project. It looks like something became confused as to which build tools to use, since uninstalling the 2019 ones resolved this for me.

answered on Stack Overflow Jan 20, 2021 by vee

User contributions licensed under CC BY-SA 3.0