How to run UCMA 4 applications on a Skype for Business Application Server with UCMA 5 only
If you try and run a UCMA application which is compiled using UCMA 4 on a Skype for Business application which has only had the UCMA 5 run-time installed, then you’ll get an error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Rtc.Collaboration, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
This is slightly confusing, because version 5 of Microsoft.Rtc.Collaboration is actually UCMA 4. UCMA 5 includes a new version of the Microsoft.Rtc.Collaboration DLL, version 6.
Even if you copy over the DLL from your development machine to the application folder, in an attempt to appease the error, you’ll just run into a problem with one of its dependencies the first time you try and do anything with it:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘SIPEPS, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
at Microsoft.Rtc.Collaboration.CollaborationPlatformSettings..ctor(String applicationUserAgent, SipTransportType transport)
at Microsoft.Rtc.Collaboration.ClientPlatformSettings..ctor(String applicationUserAgent, SipTransportType transport)
The correct answer to this problem, of course, is to recompile your application using the UCMA 5 SDK. However, for many reasons this might not always be possible or preferable. There is a workaround to this however.
Because there has been such little change (no change?) between UCMA 4 and UCMA 5 we can tell our application just to use UCMA 5, even though it knows it’s supposed to be using UCMA 4. We can do this without recompiling by using Assembly Binding Redirection, configured in the application’s config file.
Open the .exe.config file for your application, and add the following section within the configuration section:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Rtc.Collaboration" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="126.96.36.199" newVersion="188.8.131.52"/> </dependentAssembly> </assemblyBinding> </runtime>
What this does is tell the application: “Hey, I know you wanted version 5 of the Microsoft.Rtc.Collaboration DLL (UCMA 4), but don’t do that, use version 6 (UCMA 5) instead”. Because version 6 has been installed as part of the UCMA 5 runtime, the application should find it just fine.
Because it’s a run-time configuration change, this isn’t really a solid solution and it’s obviously always preferable to recompile properly and test that everything still works OK with UCMA 5 – but if you’re in a bind and need to get something working on a new server – this should help you.