PostTeamsMessage.xaml: No compiled code to run error BC30002: Type 'Net.WebClient' is not defined. At line 23 Type 'Net.WebClient' is missing. You probably need to add an Activity Package to your workflow

Hi everyone,

When the process was run, this error emerged:
No compiled code to run
error BC30002: Type ‘Net.WebClient’ is not defined. At line 23 Type ‘Net.WebClient’ is missing. You probably need to add an Activity Package to your workflow.

Here below are the codes in InvokeCode-Post Message:
Try
in_title = in_title.Replace(“", “\”)
in_title = If(in_title.Length>50, in_title.Substring(0,50), in_title)
in_text = in_text.Replace(”", “\”)
in_text = If(in_text.Length>300, in_text.Substring(0,300), in_text)
Dim payLoad As String = String.Format(
“{{”“@type”“: ““MessageCard””,” & _
“”“@context”“: ““https://schema.org/extensions””,” &
“”“summary”“: “”{0}”“,” &
“”“themeColor”“: ““0000ff””,” &
“”“title”“: “”{0}”“,” &
“”“sections”“: [{{” &
“”“text”“: “”{1}”“” &
“}},{{” &
“”“activityTitle”“: “””“,” &
“”“activitySubtitle”“: “”{2} [Machine] {3} [Project] {4} ({5})”“” &
“}}]” &
“}}”,
in_title,
in_text,
Datetime.Now.ToString(“yyyy/MM/dd (ddd) HH:mm:ss”, New System.Globalization.CultureInfo(“ja-JP”)),
in_mname, in_pname, in_pversion
)
Dim wc As New Net.WebClient
wc.Encoding = System.Text.Encoding.UTF8
Console.WriteLine("PostTeamsMessage - [request] " & payLoad)
Dim res As String = wc.UploadString(in_url, payLoad)
Console.WriteLine("PostTeamsMessage - [response] " & res)
Catch ex As Exception
Console.WriteLine("PostTeamsMessage - [error] " & ex.Message)
End Try

Any helps are appreciated.
Thanks in advance.

Hey @Dingkun_Yang have you Import System.net Assembly from the imports toggle

cheers

Thanks for your reply @singh_sumit
You mean here?

Also, this alarm was found:


Should I make any actions?

Hey @Dingkun_Yang can you try to update UiPath.System.Activities package from the Manage package section.

Thanks for your reply @singh_sumit
After updating UiPath.System.Activities package

The same error emerged:

20250124 PostTeamsMessage Successful.xaml (13.9 KB)

Thank you, @singh_sumit. The error has been fixed, and I will upload the XAML file in case any other similar errors occur.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.