I am having a very frustrating time trying to resolve an issue I have been experiencing. I have 1 solution which contain three different projects within it.
The first project has NO reference to anything in the other two.
The second project references the DLL produced by the first project.
The third project references the DLL produced by the first project and also the DLL produced by the second project.
Now my issue is that in the third project i instantiate some web custom controls from the DLL in the second project and the desired result is achieved.
Now when i try and instantiate an object in the third project from the DLL that is referenced and produced from the first project I get the following :
Could not load type 'namespace.User' from assembly 'assemblyName, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null'.
I have tried removing all references and deleting dll files, recompiling, deleting the temporary files in the asp.net directory. I have tried everything and i cant seem to find out whats wrong.
If one of the assemblies works fine, why doesnt the other?
The error suggests that the DLL could not be found and therefore could not be loaded, however i see the DLL in the directory.
Any help would be greatly appreciated!
martin2dabo:The error suggests that the DLL could not be found
Not quite. What it is saying is, it found the DLL, but it couldn't find a type named "namespace.User" from within that DLL. It was expecting to find that type in that particular assembly, but did not.Cheers,Kevin Jones
0 vcsjones11/16/2007 12:22:07 AM
Thanks for your reply,
Now, i have another question. When i load up the DLL in object explorer I see the type User() in there? What possible reason could there be that it cant find the type? Is it referencing a cached DLL thats old or not the most recent one? The one I see in the BIN directory has a time stamp that is current.
The only thing at that point, is it referencing the wrong version of the DLL for some reason.Cheers,Kevin Jones
0 vcsjones11/16/2007 12:38:21 AM
So i built each project again, made sure that each dll was last modified to the current date and time which they were. I removed all references from each project and readded them. Still I get the same problem. This is a nightmare.
I appreciate your response.
Are you sure you are adding the right references? Perhaps you are adding a reference to an older version of the DLL, and the newer one is getting compiled into another location?Cheers,Kevin Jones
0 vcsjones11/16/2007 1:00:00 AM
I am positive that the references are correct as i always check for the last modified date on the dll before adding it as a reference. It seems as if it is not using the DLL in the BIN folder and using an old version that is stored somewhere. Do the files in the temporary asp.net folder have anything to do with this?
Ok, I just noticed something interesting. I looked in the asp.net temporary files directory and found the DLL. The size of the DLL is 24kb where as the updated one in the bin directory of the project is 28kb (both have the same modified date). Now why would it be an older version when i am building a new one all the time?
Ok, so I have done some further tests on this issue and found something else that i quite interesting.
I searched my whole computer for any instance of the named DLL. I then deleted all files so my computer according to the search mechanism in windows XP has no instance of said DLL as far as I know.
Now, i also consolidated two of the projects into one which yielded no new results.
When i rebuilt the project that is causing the problems it isnt producing the correct DLL, rather it is produced a very old one that was built two weeks ago. I dont understand where this DLL can be coming from.
Any thoughts anyone?
Have you already solved your problem ? Cause i'm dealing with the exact same problem !
You need to add the DLLs to the GAC. To do this, you will need to sign the assembly with a strong name prior to building the DLL. You can achieve this by going to the 'Property' settings for the DLL project in VS, and under 'Signing' you can add a strong name key.
After re-building you simply drag your new DLLs into the C:\WINDOWS\assembly folder within 'Windows Explorer'.
In my experience, using User as a namespace node always throws a monkey in the works. I too have the same issue (but it works locally) but when I post to my server I get errors stated above. I renamed my namespace to something other than user and it works fine now.
Thank you! "nezumi"
I have done the problem by doing what you said.
"Hope its your Solution so Mark it as Answer"
Microsoft Valuable Geek