Question

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...

Was it helpful?

Solution

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

OTHER TIPS

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.

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

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.

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top