D365-FO Retail TestClient Logon error on devbox VM
I have recently been working on the Version 10 devbox virtual machine and wanted to make use of the Retail TestClient. While I was able to successfully activate my device (but be an mPOS not a cPOS device in order to successfully activate) I was not able to logon using the worker username and password. I was sure these were correct as I used them to login to the POS system.
At the bottom of the TestClient form there is a handy "Debug" button where you can see a detailed stack trace of what is going wrong. Here I could see the following message of interest:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
It seems that by default there is a dependent assembly which is referencing a newer version (4.2.0.0) of the System.Net.Http DLL then what is available on the VM which is clearly 4.0.0.0 as can be seen in the screenshot below.
In order to solve this, I located the app.config file from Solution Explorer and added a Runtime assembly redirect binding.
<dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="4.2.0.0" newVersion="4.0.0.0"/> </dependentAssembly>
The above needs to be added within the <assemblyBinding> tag which is within the <runtime> tag as shown in the screenshot below.
After running the project again, activating, and entering credentials I am now successfully logged in with my retail worker credentials and ready to test my extensions!
*This post is locked for comments