0

SHORT QUESTION: How can I use a project reference but build my assembly so the reference is a specific version reference?


LONG QUESTION (more details): We're working on a modular setup for one of our applications. Different sets of software components are loaded, along with their dependencies, into isolated AppDomains.

There are libraries that might be referenced by different components. In some cases, we're running into assembly conflicts. IE we've got the newest version of a library loaded AND an old version and one of the Types being used (components are instantiated using reflection) needs to grab something that's no longer in the new version, ie a type whose name has been changed or something, so a TypeLoadException or whatever is thrown because it's trying to pull the type from the new version even though the old version has also been explicitly loaded. The way to avoid problems like this, it seems, is to reference specific versions.

As far as I understand it, the way to set a reference up this way from Visual Studio is to set the Specific Version property on the reference to true, and this can only be done when you're referencing a DLL as a file reference NOT as a project reference. The problem is that these other libraries are still in development so I'll potentially need to be debugging them too during tests. I want to be able to do all the nice stuff project references let you do ie navigate to definitions (mostly that, really, so i can set breakpoints while debugging and etc).


<Edit> In response to Slak's question, yes I do need to run both versions. It's explained in the LONG QUESTION.

Joshua Evensen
  • 1,544
  • 1
  • 15
  • 33

2 Answers2

0

I believe what you are asking is something I have had to face before, but for platform specific dlls. You could easier adapt this to your requirements.

How to reference different version of dll with MSBuild

Community
  • 1
  • 1
mickyjtwin
  • 4,960
  • 13
  • 58
  • 77
0

The solution that ended up working was actually signing all the assemblies in question and using custom resolution logic. Specific Version did indeed have nothing to do with it.

Joshua Evensen
  • 1,544
  • 1
  • 15
  • 33