Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fody 2.5.0 not looking at packages.config versions #524

Closed
uecasm opened this issue May 8, 2018 · 7 comments
Closed

Fody 2.5.0 not looking at packages.config versions #524

uecasm opened this issue May 8, 2018 · 7 comments

Comments

@uecasm
Copy link

uecasm commented May 8, 2018

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.

@SimonCropp
Copy link
Member

is it not possible for you to update to the new sdk style of csproj?

@uecasm
Copy link
Author

uecasm commented May 12, 2018

Not unless VS2015 supports that, which I don't think is the case.

@SimonCropp
Copy link
Member

any reason you cannot move to VS 2017?

@lennartb-
Copy link

lennartb- commented May 24, 2018

@SimonCropp, do you mean <PackageReference /> with "new style of csproj"? I have the same issue, but it occurred when migrating from packages.conf to PackageReference style.

@SimonCropp
Copy link
Member

@lennartb- r u mixing the old csproj format with PackageReference ? if so that is not supported https://github.com/Fody/Fody#project-formats

@lennartb-
Copy link

Yep, that's why I'm asking. I'll to to move entirely to the new csproj format then and report back

@SimonCropp
Copy link
Member

let me known how u go. until then i will close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants