Could not load file or assembly, PublicKeyToken=null

95,599

Solution 1

This error usually means that the assembly was not found. Try verifying that the file exists in the directory where your application is running.

If you still can't figure out which file fails loading, try using a tool such as Fusion Log Viewer (run fuslogvw.exe from the Visual Studio command prompt), to determine which files the CLR was trying to load and from where, so that you can see exactly what failed.

Solution 2

I experienced the same problem, and the reason was that I compiled my EXE and DLL on 32 bit machine for "x86", because it depends on C++\CLI library compiled for Win32. Then I tried to use this library on 64 bit machine from 64 bit process. Obviously 64 bit process can't load 32 bit libraries, so I got this error, which does not really help to understand the problem.

So the reason could be that you try to use 32 bit library from 64 bit process.

Solution 3

Building over nogard answer, try setting the Solution Platform to x86

enter image description here

Share:
95,599
senzacionale
Author by

senzacionale

Updated on July 05, 2022

Comments

  • senzacionale
    senzacionale almost 2 years

    Could not load file or assembly 'NCrawler.GeckoProcessor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

    When I call CrawlUsingGeckoProcessor.Run();

    What does this mean? I can click "go to definition" and I can see the Run() method.

  • Jeremy McGee
    Jeremy McGee over 12 years
    ... if the file isn't in your output folder and you'd expect it to be, make sure that for the reference you have "Copy Local" set true in the Properties window.
  • Brian Reinhold
    Brian Reinhold about 11 years
    That remark solved a frustration that I have had for the last 90 minutes. It worked fine on my other system which was 32 bit!
  • Datz Me
    Datz Me almost 10 years
    I have the same error but i verified the files its in there and i set the copy local into true but the error still exist...
  • Ricardo Almeida
    Ricardo Almeida about 2 years
    You are a lifesaver! Thanks a lot