Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileNotFoundException: "Could not load file or assembly" although assembly exists [closed]

Tags:

I am trying to create a custom membership and role provider. The code for this seems to be fine, but when I try to go to the Security section of the Web Site Administration Tool, I get the following:

The invoked member is not supported in a dynamic assembly.

In reference to the first line of the first bit of NHibernate-related code that is called:

var cfg = new Configuration(); 

followed by:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

Additional information: Could not load file or assembly 'NHibernate.XmlSerializers, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The system cannot find the file specified.

Before that I get a few:

Culture name 'aspx' is not supported.

I have the providers in the App_Code folder and the NHibernate DLLs are copied to the Bin folder on execution of the application.

I am assuming it is to do with the providers not being able to find all of the relevant classes and dlls related to NHibernate and the Role class and so on.


For whatever reason, this problem went away.

like image 273
BobTurbo Avatar asked Jul 06 '11 13:07

BobTurbo


People also ask

How do you fix Could not load file or assembly or one of its dependencies?

There are some workarounds for this issue: The dll file may not be in /bin folder. Just copy the dll file to /bin folder or set this preference Copy Local = True from Visual Studio. If the problem persists, check if the version of the assembly that is referenced is different than the version it is looking for.

Could not load file or assembly system Cannot find file specified?

For the alert error ("The system cannot find the file specified.") Right click on [Solution Program name] then select Build Dependencies> & left click on Build Customizations... then true-checkbox {MASM} then click OK button.

Could not load file or assembly culture neutral Publickeytoken null or one of its dependencies?

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

Could not load file or assembly manifest definition does not match the assembly reference?

The located assembly's manifest definition does not match the assembly reference. As stated, this is caused when the version of a . dll file in the /bin directory (assembly reference), is not the same as specified in the web. config (assembly manifest).


1 Answers

I had the same thing, turns out it wasn't really a problem. I had IDE set so that it will break on Exceptions

After reading this link below I realised.

http://www.mail-archive.com/[email protected]/msg06043.html

You can simply hit F5 and continue running. That's pretty much all I know

like image 107
David Avatar answered Oct 23 '22 08:10

David