.NET Binding Redirection for Compilation

前端 未结 5 2045
灰色年华
灰色年华 2020-12-17 17:37

I\'m getting the following error when I try and compile a utility, which uses files that have been deployed to our client.

Assembly \'*A* version 2.0.

5条回答
  •  猫巷女王i
    2020-12-17 18:34

    If I understand you correctly, you have legacy assembly A that references specific version of assembly B. At the same time you are building utility C which uses both assemblies - A and B.

    You should be able to use two different versions of the same assembly B by following steps. Not a compile time redirection, but it should work:

    1. Add reference to assembly A to your project C, set SpecificVersion = true;
    2. Add reference to assembly B version 1.1.39.0 to your project C, set SpecificVersion = true;
    3. Create a post build event that copies version 1.1.39.0 of assembly B to project output path /bin/B_1.1.39.0/B.dll;
    4. Add following binding redirects and specify custom location for assembly B with version 1.1.39.0 using codeBase element;

    Now your legacy assembly A should be happy as you have version 1.1.32.0 of assembly B in your output folder. Your utility C should be happy as well as it using specific version 1.1.39.0 of assembly B and you have provided custom location where to look for it.

    Hope it helps!

提交回复
热议问题