11

We have a project that can use two different versions of the certain DLL. We need this deployed in two different environments. Which version of the DLL is being used should depend on the environment.

One suggested solution is to copy the entire code-base and to create octopus deployment configurations based on those two code-bases.

I am strongly against this, but still don't have the solution to the problem.

I think that binary redirection won't work because I cannot specify the dll path in the config, and of course, I can't have those two files in the same directory.

Any ideas ?

tspauld
  • 3,512
  • 2
  • 25
  • 22
Ivan Davidov
  • 823
  • 1
  • 9
  • 24
  • 2
    What are you trying to accomplish by deploying different versions depending on the environment? Generally Octopus deploys the same files to each environment so it might be better to take a different approach. – tspauld Sep 01 '15 at 16:06
  • 1
    I think what you're trying to do is possible - but *not* advisable. To your point, I too would be against this but I don't fully understand why two different versions of a DLL would need to be deployed - it seems counter-intuitive. Can you explain your situation a little more? – osij2is Sep 02 '15 at 22:44
  • We have MS Exchange transport agent. Codebase can and will stay the same, the only difference is in the referenced MS dlls for version 2013 and 2016. Depending on the environment (2013 & 2016) we would like to reference different dlls. The dlls are named the same, the version is different. – Ivan Davidov Sep 03 '15 at 09:01
  • Might be better to accomplish this via dynamic assembly loading or via the GAC rather than Octopus. If you do decide to do Octopus you will probably need to do a Powershell Script. – brianfeucht Sep 10 '15 at 20:28

1 Answers1

2

It could be easily solved by powershell script, as an Octopus deploy step. For example, your project could have two files:

YourFile.dll
YourFile.v2.dll

Then your powershell script, post-step, (pseudocode) will look something similiar:

if($OctopusParameters["environment"] == "Dev") {
   File.Delete("YourFile.dll");
   File.Rename("YourFile.v2.dll", "YourFile.dll");
}

I agree though that this is quite unusual problem, and might indicate code smell.

Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78