Joe Sullivan

Does anyone know how to have two versions of the same .dll file referenced in the same .net application Let me explain. I have an application that dynamically loads forms contained in other assymblies. The assymblies are in seperate folders with all of the .dlls necessary to run that form in the same folder. The problem I am having is that each of these forms use the same .dll file with different versions. I keep running into the following error when my application tries to open one of these forms:

The located assembly's manifest definition does not match the assembly reference.

I know that this means that one of my dynamically loaded forms is finding the wrong version of the assymbly needed for that form. I'm assuming this is because it's loading the assymbly for the other form. I am not sure why this is happening. I thought that if I kept the .dlls for the forms seperate in their own folders that it would use those first when loading the assymbly for that form.

I have read other posts that would suggest that as long as my assymblies are not strongly typed (which they are not) that the assymbly resolution will look locally for the needed assymbly. My only guess is that since the .dlls that are needed for the form are in a folder seperate from the initially run application that it is by default looking in the GAC because it can't find it locally.

This is my suspicion since if I copy the .dll that is giving me the problem to the folder running my main loader application then my form runs fine. If that is the case then I don't know how to make sure that each of my forms uses the correct version of their respective assymblies since I can't very well copy two versions of the same file into the same folder. I have searched and searched and tried everything I can think of with no luck. Any ideas

If examples are needed I can see if I can post screen captures somehow.

Thanks,

Joe



Re: .NET Base Class Library The located assembly's manifest definition does not match the assembly reference.

nobugz

To avoid problems like this, you must copy the assembly with the required version in the .exe path or install both assemblies in the GAC.





Re: .NET Base Class Library The located assembly's manifest definition does not match the assembly reference.

Joe Sullivan

Yes, that is exactly the problem. I have two versions of the same assembly being used in the same application. It is because I have two forms dynamically being loaded in that may have been created referenceing different versions of the same .dll file. I can't copy two versions of the same assembly in the .exe path. I am also trying to avoid having to manually add the versions in the GAC since I don't know which versions I'm going to need until I load the requested form dynamically. That is unless there is a way to load it in the GAC dynamically through my code.




Re: .NET Base Class Library The located assembly's manifest definition does not match the assembly reference.

nobugz

Oh yuck, the forms are in the same app. The CLR won't let you load two different versions of an assembly. The only possible approach is isolating the forms in their own assembly and load them into a separate AppDomain. I'm not sure if that is actually possible with the Form type. Perhaps if they run on their own thread. That's truly ugly too.





Re: .NET Base Class Library The located assembly's manifest definition does not match the assembly reference.

Joe Sullivan

Oh, well. Looks like we need to figure out a new way to do what we are trying to do. I just wanted to confirm that what I was trying to do was not possible or if I was just going crazy. We're trying to have a loader application that dynamically loads and updates our applications so they are all updated and in one place. We tried using AppDomains but there was no way to have the Apps be a window in the loader application. Anyways, we'll come up with some solution. Thanks for your help.

Joe