Pages Menu
TwitterRssFacebook

Posted by on Sep 9, 2015 in Development, Skype for Business® (Lync®)

How to run UCMA 4 applications on a Skype for Business Application Server with UCMA 5 only

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=5.0.0.0, 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=5.0.0.0, 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="5.0.0.0" newVersion="6.0.0.0"/>
</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.

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.