Reputation: 2393
I have a project like this:
Test Solution
Project TestApplication
References: TestFunctions.dll(ver 1.0.0.0),Project TestDLL
Project TestDLL
References: TestFunctions.dll(ver 1.0.0.1)
In the application when i make a call to TestDLL.Methodx() inside it calls TestFunctions.HelloWorld() but it gives a MissingMethodException because TestFunctions.HelloWorld() only exists in TestFunctions.dll(ver 1.0.0.1) and it tries to call the function in the ver 1.0.0.0 dll...
How can I force it to call to the correct version?
I tried using "extern alias" to no avail...
Upvotes: 0
Views: 6220
Reputation: 2393
At the end I solved this as in my other question, renaming the TestFunctions.dll
according to the project that uses it. It's more handwork but at least it works.
I don't know if some of the other answers will work too because I don't have much time for testing them. Sorry people. Thanks for the help!
Upvotes: 0
Reputation: 10650
You'd have to sign your assemblies (give them a strong name), and put them in the GAC, or if you are using Visual Studio, you'd have to build the two different versions into different output folders, and set the references to the file path, not the project output. Then in the properties for the reference, you can change the Specific Version to true.
Upvotes: 0
Reputation: 45799
The only way you can "force" it to call the correct DLL is to have the correct DLL referenced, i.e. you'll need to remove the reference to v1.0.0.0 and add a reference to v1.0.0.1
Upvotes: 0
Reputation: 11520
I believe Visual Studio will only allow for one version of a DLL at a time.
Perhaps try loading the 1.0.0.1 version at run-time - Assembly.Load() - to solve this.
Upvotes: 0
Reputation: 4638
Rename referenced dlls to TestFunctions1.0.0.0.dll and TestFunctions1.0.0.1.dll
If the two references have the same name one will be overriden by the other one on compile
Upvotes: 2