Description
Classic C#.NET project using this as part of its packages.config:
<package id="Costura.Fody" version="1.6.2" targetFramework="net462" developmentDependency="true" />
<package id="Fody" version="2.5.0" targetFramework="net462" developmentDependency="true" />
However when it runs it is picking up a different version of Costura.Fody (because it is present in the packages directory, despite not being specified in the config):
...
Fody: FindAddinDirectories:
Fody: No PackageDefinitions
Fody: Skipped SolutionDir/Packages convention 'S:\Sizer\Simulator\Packages' since it doesn't exist.
Fody: Scanning directory from Nuget Config: X:\packages'.
Fody: Fody weaver file added 'X:\packages\Costura.Fody.1.6.2\Costura.Fody.dll'
Fody: Fody weaver file added 'X:\packages\Costura.Fody.2.0.0\netclassicweaver\Costura.Fody.dll'
Fody: Scanning the MsBuildThisFileDirectory parent: X:\'.
...
Fody: Weaver 'X:\packages\Costura.Fody.2.0.0\netclassicweaver\Costura.Fody.dll'.
Fody: Initializing weaver
Fody: Loading 'X:\packages\Costura.Fody.2.0.0\netclassicweaver\Costura.Fody.dll' from disk.
MSBUILD : error : Fody: An unhandled exception occurred:
MSBUILD : error : Exception:
MSBUILD : error : Could not load file or assembly 'Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
MSBUILD : error : Type:
MSBUILD : error : System.IO.FileLoadException
MSBUILD : error : StackTrace:
MSBUILD : error : at ModuleWeaver..ctor()
MSBUILD : error : at lambda_method(Closure )
MSBUILD : error : at InnerWeaver.InitialiseWeavers()
MSBUILD : error : at InnerWeaver.Execute()
MSBUILD : error : Source:
MSBUILD : error : Costura.Fody
MSBUILD : error : TargetSite:
MSBUILD : error : Void .ctor()
MSBUILD : error : The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
MSBUILD : error : Type:
MSBUILD : error : System.IO.FileLoadException
It should be reading the packages.config file and using that version only, not any other version it happens to find in the package folder.
Also, Costura is failing to load; I'm not sure if that's related to the version mismatch or not.
After updating Fody to 3.0.3 (which also forces Costura to 2.0.0, which in turn also removes all Costura elements from my FodyWeavers.xml, which I'm not happy about), the loading error no longer occurs. I can't prove whether it uses the "right" version of Costura any more since there isn't another version that's compatible with 3.0.3, but I suspect that it's still not using packages.config.
Activity