YoutubeExtractor icon indicating copy to clipboard operation
YoutubeExtractor copied to clipboard

Could not load file or assembly

Open ijourneaux opened this issue 12 years ago • 13 comments

I have been using YouTube Extracker for some time in my project HD-Trailers.net Downloader. It always works on my computers but I ahve a user you gets the attached error message. Any idea why this might be happening and what the solution might be?

10/9/2014 11:55:41 AM - ERROR: Problem with youtubeDownloader 10/9/2014 11:55:41 AM - System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl, Boolean decryptSignature) at HDTrailersNETDownloader.Program.YouTubeDownload(String downloadURL, String fName, String dirName, String qualPref)

=== Pre-bind state information === LOG: DisplayName = Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/HD-Trailers.NET Downloader/ LOG: Initial PrivatePath = NULL Calling assembly : YoutubeExtractor, Version=0.10.4.0, Culture=neutral, PublicKeyToken=null. LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Post-policy reference: Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting download of new URL file:///C:/Program Files (x86)/HD-Trailers.NET Downloader/Newtonsoft.Json.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

ijourneaux avatar Oct 10 '14 20:10 ijourneaux

Well, are you including Newtonsoft.Json in you application?

flagbug avatar Oct 10 '14 20:10 flagbug

Yes. Copying the files to the program folder. A search on the Web indicated that it could be related to a version conflict. Other users haven't complained about it and I don't have an an issue on the computer I use.

--- Original Message ---

From: "Dennis Daume" [email protected] Sent: October 10, 2014 3:18 PM To: "flagbug/YoutubeExtractor" [email protected] Cc: "ijourneaux" [email protected] Subject: Re: [YoutubeExtractor] Could not load file or assembly (#87)

Well, are you including Newtonsoft.Json in you application?


Reply to this email directly or view it on GitHub: https://github.com/flagbug/YoutubeExtractor/issues/87#issuecomment-58710627

ijourneaux avatar Oct 10 '14 21:10 ijourneaux

Hm, this is a problem on your end, not much I can do about it

flagbug avatar Oct 11 '14 13:10 flagbug

Sorry for double posting. I didn't see it listed and thought I hadn't posted it yet. Totally my mistake.

I also realize that it is something on my end but I haven't been able to figure it out and was hoping for some words of wisdom. I believe the problem was cause by my upgrading to a newer versino of Newtonsoft.json.

I won't have opened it as an issue but GitHub doesn't seem to have a discussion forum.

ijourneaux avatar Oct 14 '14 18:10 ijourneaux

Maybe you're missing a binding redirect in your app.config

flagbug avatar Oct 14 '14 18:10 flagbug

My App config seem to be ok. AssemblyBinding is listed below. Perhaps I am not including the correct dlls in my my setup package. Right now my installer just copies the dll and xml files to the profile Files folder.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

ijourneaux avatar Oct 14 '14 19:10 ijourneaux

Looks fine to me. Maybe your installer failed to replace an old version of Newtonsoft.Json?

flagbug avatar Oct 14 '14 19:10 flagbug

I have tried everything I can think of. I can't get past this error. I have confirmed that all of the dlls installed on the target computer are correct. I think I have read every thread on google about this error but I have not been able to get any of the proposed fixes to fix my problem.

The odd thing is the error specificly refers to Newtonsoft.json 4.5.0.0. I can't find that mentioned anywhere in the project.

Just a couple of things about my project. I have it set up for the 4.5.1 framework. I use the NuGet RestSharp, TMDBLib, Newtonsoft.Json and YouTubeExtractor. There is an fifth dll rssreader.

I am all ears if you have any ideas I can try. Ian

ijourneaux avatar Oct 18 '14 23:10 ijourneaux

same error here, tried all kinds of different things...still havent found a fix

cb01987 avatar May 25 '15 23:05 cb01987

I wish I could help but I don't remember exactly how I got past this but I did get past it.

ijourneaux avatar May 26 '15 15:05 ijourneaux

Repost:

I also have had this issue, app been working fine for months, all of a sudden throwing an exception...

I had several different threads working on getting data and also downloading, this seems to be a thread based issue, I moved the line:

IEnumerable videoInfos = DownloadUrlResolver.GetDownloadUrls(link);

To the main thread and its all good, at least that's at the moment. Very strange, my app as had nothing change, an odd problem!

PS: Great Lib, thanks so much for your excellent hard work here!!!

GuntaButya avatar Dec 16 '16 05:12 GuntaButya

I run up a Console Application today as a test, Newtonsoft was not installed/included in the Packages folder.

I had to use Version: 5, 0, 8, 16617

Newer versions do not work.

GuntaButya avatar Apr 21 '17 02:04 GuntaButya

I was having that issue too. It kept telling me to use Json 6.0.6 and it kept giving me an error. What I did was recompile with ALL of the updates and then I added Newton Json 10.0.1.2. That was this morning and it is working well now.

retro617 avatar Apr 21 '17 02:04 retro617