Hi,
I'm trying to use HttpClient in my QAction but I get the following error:
error CS0246: The type or namespace name 'HttpClient' could not be found (are you missing a using directive or an assembly reference?)
But I'm using:
using System.Net;
using System.Net.Http;
I'm a little bit lost now why it's showing the error. Any idea?
HttpClient lives in the System.Net.Http.dll assembly which is not referenced by default in SLScripting (the process which is executing the QActions) so you need to tell the QAction where you're using HttpClient to do so.
This can be achieved by configuring it through the dllImport attribute of the QAction.
e.g:
<QAction id="1" name="MyQAction" encoding="csharp" triggers="1" dllImport="System.Net.Http.dll">
Alternatively, if you're using DIS, you can just reference the dll in your QAction project and it will set everything right for you in the background.
Right click QAction project > Add > Project Reference... > Assemblies > System.Net.Http > OK
Hi Stefan,
I see that this question has been inactive for some time. Do you still need help with this? If not, could you select the answer (using the ✓ icon)?