0

I searched around but couldn't find a solution for my dll issue.
My solution adds many dll references and each dll is strongly version dependent.
I just want to recompile one of them separately and add it back to the solution.
However, since other dlls are version dependent and reference this dll some run-time errors happen saying the version is not the expected one.
How can I work around this situation?

Chris
  • 259
  • 1
  • 4
  • 14
  • Could you clarify it a little bit. For example, you could say that you have assembly A referencing assembly B and C, assembly B also referencing assembly C, and you it does not work if you recompile only assembly C and A. – Dennis Jan 08 '13 at 02:31
  • The solution compiles. This issue happens when I only recompile a single dll and put it back into the folder. – Chris Jan 08 '13 at 03:08

2 Answers2

1

This really depends on how you have your SOLUTION laid out. If you have the DLLs as PROJECTs inside of the same SOLUTION as the program that uses them and the other DLL files, you can just right click on the DLL project you want to recompile and click rebuild.

Hope this helps you!

Carson63000
  • 4,215
  • 2
  • 24
  • 38
FrostyFire
  • 3,212
  • 3
  • 29
  • 53
1

Assembly redirection publisher policy entries in config file can solve that. Here is snippet of the sample from the article (you can also redirect ranges of versions too):

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" 
          publicKeyToken="32ab4ba45e0a69a1" culture="en-us" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
        ....

Side note: you should consider your version policy more carefully. If you give assemblies to other people it may be better to avoid auto-generated version and use one version for each official release, potentially with minor versions for interim builds. Building all projects at the same time may be good idea to.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • I just read about the article and publisher policy is something new for me. Where I can find this file? – Chris Jan 08 '13 at 03:26
  • 1
    @Chris, for exe - "EXE_NAME.exe.config", for asp.net web site: "web.config". Note that you can't specify configuration for [assembly/class library](http://stackoverflow.com/questions/5674971/app-config-for-a-class-library), it must be for an [application](http://support.microsoft.com/kb/815786). – Alexei Levenkov Jan 08 '13 at 03:33
  • 1
    But this redirection mechanism requires the dll to be put into GAC. Just strong name is not enough. – linquize Jan 08 '13 at 03:38
  • 1
    @linquize, the policy applied to both normal search path and GAC'ed assemblies to my knowledge, but I would not be surprised if I'm wrong on it. Link that confirms your statement would be useful. – Alexei Levenkov Jan 08 '13 at 05:35