Search code examples
nunitnbehave

NBehave and NUnit-2.5.5.10112 can work together?


I'm using Unit-2.5.5.10112. How can I use also NBehave, if it has dependency on an older version of NUnit?

Should I ignore NBehave?


Solution

  • You can get NBehave 0.4.5 to use NUnit 2.5.5.10112 by doing the following:

    First, create an NBehave-Console.exe.config containing the following:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="nunit.framework"
                              culture="neutral"
                              publicKeyToken="96d09a1eb7f44a77" />
            <bindingRedirect oldVersion="2.5.2.9222" newVersion="2.5.5.10112" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    

    This tells the CLR loader that when NBehave-Console.exe looks for 2.5.2.9222 of nunit.framework, it should use 2.5.5.10112 instead.

    Second, put nunit.framework.dll version 2.5.5.10112 in the C:\Program Files\NBehave\0.4.5.183 directory, replacing the older version.