System.IO.FileLoadException when multiple target is set to netcoreapp2.0 and net461
See original GitHub issueI attach a Visual Studio 2017 solution for better understanding. I’ve set up a console app which targets two frameworks: netcoreapp2.0 and net461.
This console app references a netstandard2.0 library. This library references Compare-NET-Objects NuGet pacakge, Version 4.53.0.
Publish the app from the console app directory via
dotnet publish -f netcoreapp2.0
and
dotnet publish -f net461
When running the netcoreapp2.0 all is fine, when running the net461 exe I’ve got the following exception:
System.IO.FileLoadException
HResult=0x80131040
Message=Die Datei oder Assembly "KellermanSoftware.Compare-NET-Objects-Core, Version=4.54.0.0, Culture=neutral, PublicKeyToken=dccbd7ce7d6a58c0" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)
Source=Jaxx.CompareNetCore.Shared
StackTrace:
at Jaxx.CompareNetCore.Shared.Comparer.CompareEqual() in D:\WORK\_Playground\Jaxx.CompareNetCore\Jaxx.CompareNetCore.Shared\Comparer.cs:line 12
at Jaxx.CompareNetCore.ConsoleApp.Program.Main(String[] args) in D:\WORK\_Playground\Jaxx.CompareNetCore\Jaxx.CompareNetCore.Console\Program.cs:line 13
Obviously framework searches for Compare-NET-Objects-Core.dll - which is not deployed o the project. (Instead Compare-NET-Objects.dll is deployed to into the net461 build)
A bit confusing too is file version of Compare-NET-Objects.dll, it’s 4.53.0 while version of Compare-NET-Objects-Core.dll is 4.54.0.
Found #94 , but this seems not to be the same.
Thanks for help.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
@viper3400 @jasase @ltrzesniewski This should be fixed in the latest build.
@jasase the fix outlined in #108 and the associated pull request fixed the issue for me. If you need a short term fix you can pull that and build it . Also thanks to @ltrzesniewski for figuring it out.