简体   繁体   中英

Could not load file or assembly asp.net

There are some authentication changes recently in our company and we are supposed to change the authentication systems in all the applications. We have a dll (Auth.dll) that has this logic about the authenticaion. All our applications has these Auth.dll file and uses the same logic for authentication.

Our strategy for this is to just modify the dll to use new authentication logic. The method signatures remains same, since those are the methods we call from other places in all our applications.

We have an archive application (built on .Net framework 2.0) in our company which a few users still use.The problem for these archive applications is that we dont have the source code. So i am just trying to create a new dll and replace it on the production server on the location where old dll was hosted. Everything else stays the same.

I created the new dll using framework 2.0. I have unit tested it and works fine. The issue i am getting is -

Could not load file or assembly 'Auth, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=ae1958e6e8b32d9c' or one of its dependencies. The system cannot find the file specified.

I checked the public key token on the new Auth.dll and it looks ok. The version also looks ok. The Auth dll has the references to only 4 .Net framework 2.0 assemblies.

Any idea what may be wrong?

Thanks

You could easily get the source code for the dll by using something like http://ilspy.net/ , this would then allow you to get the source code and recompile. I've always has a hard time tracking down these types of issues, but again if you use ILSPY you should be able to see all of the DLL's that the Auth.dll is referencing.

As an absolute last resort you could use some of the tools from sysinternals to see what is being accessed on the hard drive when this is being loaded to see if the reference dll simply isn't there. Hope this helps.

Did you register auth.dll in the gac, or put it in the archive applications bin folder?

Also if the archive application was referrencing the old auth.dll, then the signature of the new one will need to match the old one exactly, and by that I mean it's full qualified type name.

Eg

Auth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ae1958e6e8b32d9c

Needs to be the same now as it was before.

Or you'll have to do as punkcoder suggested and rebuild the source with ILSpy or use ILDASM and change the reference and ILASM to put it back together.

Do you search in C:\\Windows\\assembly and find the assembly ? Case no, you have to install or get the same version of your component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM