question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.IO.FileLoadException when multiple target is set to netcoreapp2.0 and net461

See original GitHub issue

I attach a Visual Studio 2017 solution for better understanding. I’ve set up a console app which targets two frameworks: netcoreapp2.0 and net461.

Jaxx.CompareNetCore.zip

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.

grafik

Found #94 , but this seems not to be the same.

Thanks for help.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
GregFinzercommented, Sep 27, 2018

@viper3400 @jasase @ltrzesniewski This should be fixed in the latest build.

0reactions
twurmcommented, Jul 18, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to target netcoreapp2.0 and net461 in the same project
First off, you can't target both. They're mutually exclusive. However, that's not a problem, because you don't need to.
Read more >
Multi-targetting .Net Framework and .Net Core in a single project
Open your csproj file, either by right-clicking on it in Visual Studio, or in another Editor. The first step is to replace the...
Read more >
Dotnet Issues - Steve Ellwood - Medium
IO.FileLoadException : Could not load file or assembly 'ServiceStack. ... If I set the library itself to multi target then it works as...
Read more >
Please stop lying about .NET Standard 2.0 support!
In this post I have a bit of a rant about Microsoft's NuGet packages lying about supporting .NET Standard 2.0 when they kinda...
Read more >
Target frameworks in SDK-style projects - .NET
When you target a framework in an app or library, you're specifying the set of APIs that you'd like to make available to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found